Skip to content

Commit

Permalink
test: run in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mxdvl committed Apr 27, 2023
1 parent 896a3c8 commit de97860
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ jobs:

- name: Lint
run: deno lint

- name: Test
run: deno test -A
21 changes: 13 additions & 8 deletions src/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
assert,
assertEquals,
} from "https://deno.land/[email protected]/testing/asserts.ts";
import { assert } from "https://deno.land/[email protected]/testing/asserts.ts";

Deno.test({
name: "Able to build the current project",
Expand Down Expand Up @@ -30,13 +27,21 @@ Deno.test({
});

await new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, 600);
const check_if_port_is_open = async () => {
try {
const { status } = await fetch("http://localhost:4507/mononykus/", {
method: "HEAD",
});
if (status === 200) resolve();
} catch (_) {
setTimeout(check_if_port_is_open, 60);
}
};
return check_if_port_is_open();
});

const response = await fetch("http://localhost:4507/mononykus/");
assertEquals(response.status, 200);

const html = await response.text();

process.kill();
Expand Down

0 comments on commit de97860

Please sign in to comment.