mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
test(e2e): import the insights cache cipher statically in the AI-optional fixture
A dynamic import() of app code skips the runner's @/ path mapping for that module's own imports, so sealing the seeded briefing failed with "Cannot find module '@/lib/crypto'".
This commit is contained in:
1 parent
695bb1b10a
commit
c26f21fb4f
1 file changed
+4
-2
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
import pg from "pg";
|
||||
|
||||
import { sealInsightsCachedText } from "@/lib/insights/cached-text-cipher";
|
||||
|
||||
import { E2E_AI_OPTIONAL } from "./global-setup";
|
||||
|
||||
function connect(): pg.Pool {
|
||||
@@ -81,8 +83,8 @@ export async function seedStoredBriefing(marker: string): Promise<void> {
|
||||
briefingGeneratedAt: new Date().toISOString(),
|
||||
};
|
||||
// Sealed the way the app writes it; there is no readable column to seed.
|
||||
const { sealInsightsCachedText } =
|
||||
await import("@/lib/insights/cached-text-cipher");
|
||||
// The import is static on purpose: a dynamic `import()` of app code bypasses
|
||||
// the test runner's `@/` path mapping for that module's own imports.
|
||||
const sealed = Buffer.from(sealInsightsCachedText(JSON.stringify(insights)));
|
||||
await withAccount(async (pool, userId) => {
|
||||
await pool.query(
|
||||
|
||||
Reference in new issue
Block a user