Skip to content

Commit

Permalink
tests-passing
Browse files Browse the repository at this point in the history
  • Loading branch information
uriva committed Nov 23, 2024
1 parent ceb4628 commit aabc5c0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/taskBouncer.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import axios from "npm:axios";
import type { Server } from "node:http";
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import { bouncerServer, staticFileEndpoint } from "./taskBouncer.ts";

Deno.test("init", async () => {
const server = await bouncerServer("http://localhost", "1234", []);
server.close();
await closeServer(server);
});

Deno.test("static endpoint", async () => {
Expand Down Expand Up @@ -52,18 +51,18 @@ Deno.test("cors", async () => {
return Promise.resolve();
},
}]);
// We are using axois here because it closes the connection, otherwise the test hangs.
const response = await axios.get(`${url}/hello`, {
const response = await fetch(`${url}/hello`, {
headers: { "Origin": "http://example.com" },
});
assertEquals(response.headers["access-control-allow-origin"], "*");
assertEquals(response.headers.get("access-control-allow-origin"), "*");
await response.body?.cancel();
await handlerRan;
await closeServer(server);
});

Deno.test("cors preflight", async () => {
const host = "http://localhost";
const port = "2222";
const port = "1234";
const server = await bouncerServer(host, port, [{
bounce: true,
predicate: () => true,
Expand Down

0 comments on commit aabc5c0

Please sign in to comment.