From 86da56d35bbae8c5f2d961d8b96ebe2fb39df42c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 9 Apr 2026 18:05:41 +0300 Subject: [PATCH] test(e2e): broken due to missing rebuild mechanism --- apps/server/src/routes/api/database.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/server/src/routes/api/database.ts b/apps/server/src/routes/api/database.ts index b73e25a22c..05beca3e67 100644 --- a/apps/server/src/routes/api/database.ts +++ b/apps/server/src/routes/api/database.ts @@ -1,6 +1,7 @@ import { BackupDatabaseNowResponse, DatabaseCheckIntegrityResponse } from "@triliumnext/commons"; -import { becca_loader, rebuildIntegrationTestDatabase as rebuildIntegrationTestDatabaseCore,ValidationError } from "@triliumnext/core"; +import { becca_loader, ValidationError } from "@triliumnext/core"; import type { Request } from "express"; +import { readFileSync } from "fs"; import anonymizationService from "../../services/anonymization.js"; import backupService from "../../services/backup.js"; @@ -30,7 +31,11 @@ function findAndFixConsistencyIssues() { } async function rebuildIntegrationTestDatabase() { - rebuildIntegrationTestDatabaseCore(); + // Reload the integration test database fixture into the in-memory SQL + // backend, then re-init schema-dependent state and the becca cache. + // Test-mode only — registered in routes.ts under the same env-var guard. + const fixtureBytes = readFileSync(require.resolve("@triliumnext/core/src/test/fixtures/document.db")); + sql.rebuildFromBuffer(fixtureBytes); sql_init.initializeDb(); becca_loader.load(); }