Skip to content

Commit

Permalink
fixed test so it can run in pipeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
robgruen committed Oct 31, 2024
1 parent b93bc8e commit 74b6a41
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions ts/packages/api/test/api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,26 @@ import findConfig from "find-config";
describe("api web/ws server", () => {

it("verify web server respnses", async () => {

const envPath = findConfig(".env");
assert(envPath, ".env file not found!");
const typeAgentServer: TypeAgentServer = new TypeAgentServer(envPath!);
await typeAgentServer.start();
if (envPath !== null) {
assert(envPath, ".env file not found!");
const typeAgentServer: TypeAgentServer = new TypeAgentServer(envPath!);
await typeAgentServer.start();

let response = await fetch("http://localhost:3000/");
expect(response.ok);
let response = await fetch("http://localhost:3000/");
expect(response.ok);

response = await fetch("http://localhost:3000/index.html");
expect(response.ok);
response = await fetch("http://localhost:3000/index.html");
expect(response.ok);

response = await fetch("http://localhost:3000/sdfadfs.asdfsdf");
expect(response.status == 404);
response = await fetch("http://localhost:3000/sdfadfs.asdfsdf");
expect(response.status == 404);

typeAgentServer.stop();
typeAgentServer.stop();
} else {
console.warn("Skipping test 'verify web server respnses', no .env file!");
}
})
});

0 comments on commit 74b6a41

Please sign in to comment.