astro/packages/integrations/netlify/test/edge-functions/edge-basic.test.ts
Matthew Phillips ae9ac5cbdc
Fixes using React.lazy and Suspense (#3160)
* Revert "Revert "Fixes using React.lazy and Suspense""

This reverts commit e621c2f7d3.

* Adds a changeset

* Fix ts errors

* Remove netlify metadata folder
2022-04-21 12:10:06 -04:00

25 lines
703 B
TypeScript

// @ts-ignore
import { runBuild } from './test-utils.ts';
// @ts-ignore
import { assertEquals, assert, DOMParser } from './deps.ts';
// @ts-ignore
Deno.test({
name: 'Edge Basics',
async fn() {
let close = await runBuild('./fixtures/edge-basic/');
const { default: handler } = await import(
'./fixtures/edge-basic/dist/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();
},
});