Skip to content

Commit

Permalink
tests: end-to-end build & dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mxdvl committed Apr 26, 2023
1 parent a1e8d3d commit 9b7ed62
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
3 changes: 3 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions src/build.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import {
assert,
assertEquals,
} from "https://deno.land/[email protected]/testing/asserts.ts";

Deno.test({
name: "Able to build the current project",
permissions: { run: true },
fn: async () => {
const process = Deno.run({
cmd: ["deno", "task", "build"],
stdout: "null",
stderr: "null",
});

const { success } = await process.status();
assert(success);
process.close();
},
});

Deno.test({
name: "Able to develop the current project",
permissions: { run: true, net: true },
fn: async () => {
const process = Deno.run({
cmd: ["deno", "task", "dev"],
stdout: "null",
stderr: "null",
});

await new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, 600);
});

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

process.kill();
process.close();

assert(html.startsWith(
"<!DOCTYPE html>",
));
assert(html.includes(
"<title>Mononykus – Deno + Svelte</title>",
));
},
});

0 comments on commit 9b7ed62

Please sign in to comment.