0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/integrations/netlify/test/edge-functions/dynamic-import.test.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
788 B
JavaScript
Raw Normal View History

// @ts-ignore
import { runBuild, runApp } from './test-utils.ts';
// @ts-ignore
import { assertEquals, assert, DOMParser } from './deps.ts';
// @ts-ignore
Deno.test({
name: 'Dynamic imports',
async fn() {
let close = await runBuild('./fixtures/dynimport/');
let stop = await runApp('./fixtures/dynimport/prod.js');
try {
const response = await fetch('http://127.0.0.1:8085/');
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('#thing');
2022-06-07 10:43:33 -05:00
assert(div, 'div exists');
2022-06-21 07:33:55 -05:00
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);
} finally {
await close();
await stop();
}
},
});