summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/edge-functions/edge-basic.test.ts
blob: 5cce36c7fb72de6c2927057207fb7132ecdfa73b (plain) (blame)
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
// @ts-ignore
import { runBuild } from './test-utils.ts';
// @ts-ignore
import { assertEquals, assert, DOMParser } from './deps.ts';

// @ts-ignore
Deno.test({
	// TODO: debug why build cannot be found in "await import"
	ignore: true,
	name: 'Edge Basics',
	skip: true,
	async fn() {
		let close = await runBuild('./fixtures/edge-basic/');
		const { default: handler } = await import(
			'./fixtures/edge-basic/.netlify/edge-functions/entry.js'
		);
		const response = await handler(new Request('http://example.com/'));
		assertEquals(response.status, 200);
		const html = await response.text();
		assert(html, 'got some html');

		const doc = new DOMParser().parseFromString(html, `text/html`)!;
		const div = doc.querySelector('#react');
		assert(div, 'div exists');

		await close();
	},
});