clone

a deno framework for local-first web apps that open instantly, work offline and sync when users choose

feat/fix-sync-enrollment-startup
lofi / package / astro / mod_test.ts
mod_test.ts 2.4K
1import { prepareLofiAstroConfig } from "./mod.ts";23Deno.test("prepareLofiAstroConfig materializes package-owned vendor integration", async () => {4 const root = await Deno.makeTempDir({ dir: ".", prefix: ".lofi-astro-test-" });5 try {6 const path = await prepareLofiAstroConfig({ root });7 const source = await Deno.readTextFile(path);8 if (!path.endsWith("/.lofi/astro.config.ts")) throw new Error(`unexpected path: ${path}`);9 for (10 const expected of [11 "@astrojs/preact",12 "jazz-tools/dev/vite",13 "JAZZ_APP_ID",14 "LOFI_BASE_PATH",15 "base: deploymentBase",16 'trailingSlash: "always"',17 ".lofi/package/runtime/mod.ts",18 ".lofi/package/recipes/file-handler.ts",19 ".lofi/package/recipes/protocol-handler.ts",20 ".lofi/package/recipes/related-app-discovery.ts",21 ".lofi/package/recipes/scope-extension.ts",22 ".lofi/package/recipes/web-share.ts",23 ".lofi/package/recipes/window-controls-overlay.ts",24 "^jsr:@nzip\\/lofi@[^/]+",25 "^npm:preact@[^/]+",26 "^npm:jazz-tools@[^/]+",27 'replacement: "preact/hooks"',28 'replacement: "jazz-tools/passphrase"',29 ]30 ) {31 if (!source.includes(expected)) throw new Error(`generated config omitted ${expected}`);32 }33 await Deno.stat(`${root}/.lofi/package/preact/DeviceStatus.tsx`);34 await Deno.stat(`${root}/.lofi/package/preact/RuntimeRecovery.tsx`);35 await Deno.stat(`${root}/.lofi/package/preact/live-data.ts`);36 await Deno.stat(`${root}/.lofi/package/runtime/passkey-recovery.ts`);37 await Deno.stat(`${root}/.lofi/package/runtime/live-query-store.ts`);38 await Deno.stat(`${root}/.lofi/package/runtime/startup-recovery.ts`);39 await Deno.stat(`${root}/.lofi/package/runtime/table-mutations.ts`);40 await Deno.stat(`${root}/.lofi/package/access/mod.ts`);41 await Deno.stat(`${root}/.lofi/package/recipes/file-handler.ts`);42 await Deno.stat(`${root}/.lofi/package/recipes/launch-handler.ts`);43 await Deno.stat(`${root}/.lofi/package/recipes/protocol-handler.ts`);44 await Deno.stat(`${root}/.lofi/package/recipes/related-app-discovery.ts`);45 await Deno.stat(`${root}/.lofi/package/recipes/scope-extension.ts`);46 await Deno.stat(`${root}/.lofi/package/recipes/web-share.ts`);47 await Deno.stat(`${root}/.lofi/package/recipes/window-controls-overlay.ts`);48 } finally {49 await Deno.remove(root, { recursive: true });50 }51});