File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,10 @@ import { handlers } from "./evolver";
3
3
import { seedDatabase } from "./db-data" ;
4
4
5
5
// Initialize the test database with seed data
6
+ // Since the DB mock is a singleton, we can just call this once
6
7
if ( process . env . NODE_ENV === "test" ) {
7
8
seedDatabase ( ) ;
8
9
}
9
10
11
+ // see app/entry.client.ts for the worker.start() call
10
12
export const worker = setupWorker ( ...handlers ) ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export const db = factory({
18
18
} ) ;
19
19
20
20
// Seed the database with initial data
21
+
21
22
export function seedDatabase ( ) {
22
23
// Clear any existing data
23
24
drop ( db ) ;
@@ -30,6 +31,3 @@ export function seedDatabase() {
30
31
name : TEST_DEVICE_NAME ,
31
32
} ) ;
32
33
}
33
-
34
- // Initialize the database
35
- seedDatabase ( ) ;
Original file line number Diff line number Diff line change 1
1
import { setupServer } from "msw/node" ;
2
2
import { handlers } from "./evolver" ;
3
3
4
+ import { seedDatabase } from "./db-data" ;
5
+
6
+ // Initialize the test database with seed data
7
+ // Since the DB mock is a singleton, we can just call this once
8
+ if ( process . env . NODE_ENV === "test" ) {
9
+ seedDatabase ( ) ;
10
+ }
4
11
// Note: not included here because it's not a HTTP mock - but to be aware of:
5
12
// the DB is mocked using the prisma mock, see app/utils/db.server.ts
6
13
export const server = setupServer ( ...handlers ) ;
You can’t perform that action at this time.
0 commit comments