mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-10 23:47:12 +02:00
Merge pull request #16 from purrgrammer/claude/pluggable-storage-engine-F53Fc
Make storage engine pluggable for testing
This commit is contained in:
11
package-lock.json
generated
11
package-lock.json
generated
@@ -77,6 +77,7 @@
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"eslint-plugin-react-hooks": "^5.1.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.16",
|
||||
"fake-indexeddb": "^6.2.5",
|
||||
"globals": "^15.14.0",
|
||||
"postcss": "^8.4.49",
|
||||
"prettier": "^3.7.4",
|
||||
@@ -5966,6 +5967,16 @@
|
||||
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fake-indexeddb": {
|
||||
"version": "6.2.5",
|
||||
"resolved": "https://registry.npmjs.org/fake-indexeddb/-/fake-indexeddb-6.2.5.tgz",
|
||||
"integrity": "sha512-CGnyrvbhPlWYMngksqrSSUT1BAVP49dZocrHuK0SvtR0D5TMs5wP0o3j7jexDJW01KSadjBp1M/71o/KR3nD1w==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"eslint-plugin-react-hooks": "^5.1.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.16",
|
||||
"fake-indexeddb": "^6.2.5",
|
||||
"globals": "^15.14.0",
|
||||
"postcss": "^8.4.49",
|
||||
"prettier": "^3.7.4",
|
||||
|
||||
@@ -6,12 +6,15 @@ import { describe, it, expect, beforeEach } from "vitest";
|
||||
import { selectRelaysForFilter } from "./relay-selection";
|
||||
import { EventStore } from "applesauce-core";
|
||||
import type { NostrEvent } from "nostr-tools";
|
||||
import relayListCache from "./relay-list-cache";
|
||||
|
||||
describe("selectRelaysForFilter", () => {
|
||||
let eventStore: EventStore;
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
eventStore = new EventStore();
|
||||
// Clear the relay list cache to ensure test isolation
|
||||
await relayListCache.clear();
|
||||
});
|
||||
|
||||
describe("fallback behavior", () => {
|
||||
|
||||
7
src/test/setup.ts
Normal file
7
src/test/setup.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Vitest setup file
|
||||
*
|
||||
* Polyfills IndexedDB for Node.js test environment.
|
||||
* This allows Dexie to work in tests without a browser.
|
||||
*/
|
||||
import "fake-indexeddb/auto";
|
||||
@@ -5,6 +5,7 @@ export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "node",
|
||||
setupFiles: ["./src/test/setup.ts"],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user