Skip to content

Commit 35d4500

Browse files
snomiaoclaude
andcommitted
test: mock KeyvSqlite and KeyvNedbStore to prevent SQLITE_CANTOPEN error
Added mocks for @keyv/sqlite and keyv-nedb-store to use in-memory Map instead of file-based storage. This prevents SQLITE_CANTOPEN errors during tests when the lib module tries to create SQLite cache files. The gh-priority-sync task imports from @/lib which uses KeyvSqlite for Notion caching and KeyvNedbStore for GitHub caching. These need to be mocked to avoid file system access during tests. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent b8743d0 commit 35d4500

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/tasks/gh-priority-sync/index.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ mock.module("keyv-nest", () => ({
120120
default: (...stores: any[]) => stores[stores.length - 1],
121121
}));
122122

123+
// Mock KeyvSqlite to use in-memory Map instead of SQLite
124+
mock.module("@keyv/sqlite", () => ({
125+
default: class KeyvSqlite extends Map {},
126+
}));
127+
128+
// Mock KeyvNedbStore to use in-memory Map instead of NeDB
129+
mock.module("keyv-nedb-store", () => ({
130+
default: class KeyvNedbStore extends Map {},
131+
}));
132+
123133
// Set environment variables
124134
process.env.GH_TOKEN_COMFY_PR_BOT = "test-token";
125135
process.env.NOTION_TOKEN = "test-notion-token";

0 commit comments

Comments
 (0)