Skip to content

Commit

Permalink
Add FormData tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arshia001 committed Jan 15, 2024
1 parent 74fbc60 commit 647bf01
Show file tree
Hide file tree
Showing 7 changed files with 537 additions and 180 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.js]
indent_style = space
indent_size = 2
34 changes: 18 additions & 16 deletions test-suite/js-test-app/src/main.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import {
handleHello,
handleBlob,
handleFormData,
handleRequest,
handleResponse,
handleTextEncoder,
handleTextDecoder,
handleURL,
handleAtobBtoA,
handleFetch,
handleStreams,
handlePerformance,
handleTransformStream,
} from "./test-files/index.js";
import { handleRequest as handleHello } from "./test-files/1-hello.js";
import { handleRequest as handleBlob } from "./test-files/2-blob.js";
import { handleRequest as handleHeaders } from "./test-files/3-headers.js";
import { handleRequest as handleRequest } from "./test-files/4-request.js";
import { handleRequest as handleResponse } from "./test-files/5-response.js";
import { handleRequest as handleTextEncoder } from "./test-files/6-text-encoder.js";
import { handleRequest as handleTextDecoder } from "./test-files/7-text-decoder.js";
import { handleRequest as handleURL } from "./test-files/8-url.js";
import { handleRequest as handleAtobBtoA } from "./test-files/10-atob-btoa.js";
import { handleRequest as handleFetch } from "./test-files/11-fetch.js";
import { handleRequest as handleStreams } from "./test-files/12-streams.js";
import { handleRequest as handleTransformStream } from "./test-files/12.1-transform-stream.js";
import { handleRequest as handlePerformance } from "./test-files/13-performance.js";
import { handleRequest as handleFormData } from "./test-files/14-form-data.js";

function router(req) {
const url = new URL(req.url);
Expand All @@ -25,7 +24,7 @@ function router(req) {
return handleBlob(req);
}
if (path.startsWith("/3-headers")) {
return handleFormData(req);
return handleHeaders(req);
}
if (path.startsWith("/4-request")) {
return handleRequest(req);
Expand Down Expand Up @@ -57,6 +56,9 @@ function router(req) {
if (path.startsWith("/13-performance")) {
return handlePerformance(req);
}
if (path.startsWith("/14-form-data")) {
return handleFormData(req);
}
return new Response(`Route Not Found - ${path}`, { status: 404 });
}

Expand Down
Loading

0 comments on commit 647bf01

Please sign in to comment.