-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain_test.ts
31 lines (23 loc) · 933 Bytes
/
main_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { assertEquals } from 'std/assert/equals';
import { abortController } from './main.ts';
const baseUrl = 'http://localhost:8000';
Deno.test({
name: 'HTTP Server',
fn: async () => {
let response = await fetch(`${baseUrl}/`);
assertEquals(response.status, 200);
let responseText = await response.text();
assertEquals(responseText.includes('Welcome to a Simple Deno Website Boilerplate!'), true);
response = await fetch(`${baseUrl}/dynamic`);
assertEquals(response.status, 200);
responseText = await response.text();
assertEquals(responseText.includes('This page is dynamic (wooooo)!'), true);
response = await fetch(`${baseUrl}/blah`);
assertEquals(response.status, 404);
responseText = await response.text();
assertEquals(responseText.includes('Not Found'), true);
abortController.abort('Test finished');
},
sanitizeResources: false,
sanitizeOps: false,
});