0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/integrations/deno/test/dynamic-import.test.js
Matthew Phillips c22a07db13
Fix use of dynamic imports / Astro.glob with Deno Deploy (#3532)
* Fix use of dynamic imports / Astro.glob with Deno Deploy

* Adds a changeset

* Mark the markdown package as external
2022-06-06 12:02:13 -04:00

21 lines
611 B
JavaScript

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');
});
},
});