diff --git a/examples/full/.testRun.ts b/examples/full/.testRun.ts index 59deff3..31b2d69 100644 --- a/examples/full/.testRun.ts +++ b/examples/full/.testRun.ts @@ -2,6 +2,7 @@ export { testRun }; import { test, expect, run, fetchHtml, page, getServerUrl, autoRetry, partRegex } from "@brillout/test-e2e"; import assert from "node:assert"; +const dataHk = partRegex`data-hk="${/[0-9-]+/}"`; let isProd: boolean; @@ -41,6 +42,8 @@ function testRun(cmd: `pnpm run ${"dev" | "preview"}`) { }); testNavigationBetweenWithSSRAndWithoutSSR(); + + testUseConfig(); } function testNavigationBetweenWithSSRAndWithoutSSR() { @@ -105,10 +108,8 @@ function testUrl({ expect(html).toContain(text); } - const dataHkHash = /[0-9-]+/; - expect(getTitle(html)).toBe(title); - expect(html).toMatch(partRegex``); + expect(html).toMatch(partRegex``); if (!description) description = "Demo showcasing Vike + Solid"; expect(html).toMatch(partRegex``); @@ -123,6 +124,32 @@ function testUrl({ }); } +function testUseConfig() { + test("useConfig() HTML", async () => { + const html = await fetchHtml("/images"); + expect(html).toMatch( + partRegex``, + ); + expect(html).toMatch( + partRegex``, + ); + }); + test("useConfig() hydration", async () => { + await page.goto(getServerUrl() + "/"); + await testCounter(); + ensureWasClientSideRouted("/pages/index"); + await page.click('a:has-text("useConfig()")'); + await testCounter(); + ensureWasClientSideRouted("/pages/index"); + await page.goto(getServerUrl() + "/images"); + await testCounter(); + }); +} + function getTitle(html: string) { const title = html.match(/
+ Page showcasing an <Image>
component that adds/teleports structured data (
+ <script type="application/ld+json">
) to <head>
, see HTML.
+