Skip to content

Commit

Permalink
test: add simple redirection test for server
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianCataldo committed Aug 9, 2024
1 parent 3545f39 commit c1704a0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,6 @@ const routeAssets = new Map([
"/about/",
"\t<script type=\"module\" crossorigin src=\"/assets/document.client-CMOVr55R.js\"></script>\n\n\t<link rel=\"stylesheet\" crossorigin href=\"/assets/document-aADsc6DG.css\">\n"
],
[
"/api/:path*/",
null
],
[
"/api/basic/",
null
],
[
"/assets-methods/",
"\t<script type=\"module\" crossorigin src=\"/assets/document.client-CMOVr55R.js\"></script>\n\n\t<link rel=\"stylesheet\" crossorigin href=\"/assets/document-aADsc6DG.css\">\n"
Expand All @@ -184,10 +176,6 @@ const routeAssets = new Map([
"/private/",
"\t<script type=\"module\" crossorigin src=\"/assets/document.client-CMOVr55R.js\"></script>\n\n\t<link rel=\"stylesheet\" crossorigin href=\"/assets/document-aADsc6DG.css\">\n"
],
[
"/redirect/",
null
],
[
"/response-init/",
"\t<script type=\"module\" crossorigin src=\"/assets/document.client-CMOVr55R.js\"></script>\n\n\t<link rel=\"stylesheet\" crossorigin href=\"/assets/document-aADsc6DG.css\">\n"
Expand Down
1 change: 1 addition & 0 deletions integration/src/__utils__/fetch-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface Options {
text?: string;
json?: unknown;
redirected?: boolean;
url?: string;
// body: ReadableStream { locked: false state: 'readable' supportsBYOB: true }
// bodyUsed: false
// ok: true
Expand Down
11 changes: 11 additions & 0 deletions integration/src/server-express/_common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ async function tests(mode: string, item: string, writeActual: boolean) {
true,
));

await it(`should redirect`, async () =>
checkResponse(
fetch(new URL(`/redirect/`, ADDRESS), {
method: 'GET',
}),
{
redirected: true,
url: 'http://localhost:9874/about/',
},
));

// TODO: Proper test that works with Hono. For now,
// implemented error handling is very basic with it.
// It doesn't handle stream abortion as gracefully as with Express.
Expand Down
2 changes: 1 addition & 1 deletion integration/src/server-express/dev-all-around.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ const { /* address, */ close } = await createStaticDevServer({

// ---

common('dev', writeActual);
common('dev', 'express', writeActual);

after(async () => close());

0 comments on commit c1704a0

Please sign in to comment.