summaryrefslogtreecommitdiff
path: root/packages/integrations/deno/test/dynamic-import.test.js
blob: 56d7fe5a231b17ac455774658cd6798708f44552 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { runBuildAndStartAppFromSubprocess } from './helpers.js';
import { assertEquals, assert, DOMParser } from './deps.js';

async function startApp(cb) {
	await runBuildAndStartAppFromSubprocess('./fixtures/dynimport/', cb);
}

Deno.test({
	name: 'Dynamic import',
	async fn() {
		await startApp(async () => {
			const resp = await fetch('http://127.0.0.1:8085/');
			assertEquals(resp.status, 200);
			const html = await resp.text();
			assert(html);
			const doc = new DOMParser().parseFromString(html, `text/html`);
			const div = doc.querySelector('#thing');
			assert(div, 'div exists');
		});
	},
});