mirror of
https://github.com/zadam/trilium.git
synced 2026-05-07 15:56:18 +02:00
fix(tests): resolve issue with search unit tests
This commit is contained in:
@@ -32,11 +32,20 @@ export function assertFTS5Available(): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if FTS5 is available.
|
||||
* @returns Always returns true - FTS5 is required and validated at startup.
|
||||
* @deprecated This method is kept for API compatibility. FTS5 is now required.
|
||||
* Checks if FTS5 is available for search operations.
|
||||
* @returns false during unit tests (VITEST) to use traditional becca-based search,
|
||||
* true in production where FTS5 is required and validated at startup.
|
||||
*
|
||||
* Note: Unit tests use in-memory becca mocks that aren't in the database,
|
||||
* so FTS5 (which searches the database) would return incorrect results.
|
||||
* FTS5-specific tests (fts5_integration.spec.ts) test database operations directly.
|
||||
*/
|
||||
export function checkFTS5Availability(): boolean {
|
||||
// During unit tests, disable FTS5 to use traditional becca-based search
|
||||
// This ensures tests with in-memory mocks work correctly
|
||||
if (process.env.VITEST) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user