Skip to content

Commit

Permalink
feat(tooling): first test
Browse files Browse the repository at this point in the history
It's mostly useless, but it feels good!*

See: I Got You (I Feel Good)
  • Loading branch information
lishaduck committed Dec 16, 2023
1 parent 80bcb3c commit ba64483
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deno.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
- name: Run linter, Verify formatting
run: deno task check

# - name: Run tests
# run: deno task test
- name: Run tests
run: deno task test
21 changes: 21 additions & 0 deletions src/routes/about.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { createHandler, ServeHandlerInfo } from "$fresh/server.ts";
import manifest from "../fresh.gen.ts";
import config from "../fresh.config.ts";
import { assertStringIncludes } from "$std/assert/mod.ts";

const CONN_INFO: ServeHandlerInfo = {
remoteAddr: { hostname: "127.0.0.1", port: 53496, transport: "tcp" },
};

Deno.test("HTTP assert test.", async (t) => {
const handler = await createHandler(manifest, config);

await t.step("#1 GET /about/", async () => {
const resp = await handler(
new Request("http://127.0.0.1/about/"),
CONN_INFO,
);
const text = await resp.text();
assertStringIncludes(text, "It's us, man!");
});
});

0 comments on commit ba64483

Please sign in to comment.