-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Html.test.mjs
22 lines (19 loc) · 905 Bytes
/
Html.test.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// @ts-check
import { createElement as h } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { assertStrictEquals } from "std/testing/asserts.ts";
import Html from "./Html.mjs";
Deno.test("`Html` used as a React component.", () => {
assertStrictEquals(
renderToStaticMarkup(
h(Html, {
esModuleShimsScript: h("script", { id: "esModuleShimsScript" }),
importMapScript: h("script", { id: "importMapScript" }),
headReactRoot: h("meta", { id: "headReactRoot" }),
bodyReactRoot: h("div", { id: "bodyReactRoot" }),
hydrationScript: h("script", { id: "hydrationScript" }),
}),
),
'<html lang="en"><head><script id="esModuleShimsScript"></script><script id="importMapScript"></script><meta id="headReactRoot"/></head><body><div id="bodyReactRoot"></div><script id="hydrationScript"></script></body></html>',
);
});