mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
31 lines
777 B
TypeScript
31 lines
777 B
TypeScript
// these tests involve ensuring react (html loader + single page app) works
|
|
// react is big and we do lots of stuff like fast refresh.
|
|
import { expect } from "bun:test";
|
|
import { devTest } from "../dev-server-harness";
|
|
|
|
devTest("react in html", {
|
|
fixture: "react-spa-simple",
|
|
async test(dev) {
|
|
await using c = await dev.client();
|
|
|
|
expect(await c.elemText("h1")).toBe("Hello World");
|
|
|
|
await dev.write(
|
|
"App.tsx",
|
|
`
|
|
console.log('reload');
|
|
export default function App() {
|
|
return <h1>Yay</h1>;
|
|
}
|
|
`,
|
|
);
|
|
await c.expectMessage("reload");
|
|
expect(await c.elemText("h1")).toBe("Yay");
|
|
|
|
await c.hardReload();
|
|
await c.expectMessage("reload");
|
|
|
|
expect(await c.elemText("h1")).toBe("Yay");
|
|
},
|
|
});
|