Skip to content

Commit b5050d4

Browse files
committed
Fix existing tests
1 parent 4c48d1e commit b5050d4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/query-db-collection/tests/query.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,9 @@ describe(`QueryCollection`, () => {
431431
})
432432

433433
// Verify queryFn was called with the correct context, including the meta object
434-
expect(queryFn).toHaveBeenCalledWith(expect.objectContaining({ meta }))
434+
expect(queryFn).toHaveBeenCalledWith(
435+
expect.objectContaining({ meta: { ...meta, tsDb: {} } })
436+
)
435437
})
436438

437439
describe(`Select method testing`, () => {
@@ -696,6 +698,20 @@ describe(`QueryCollection`, () => {
696698

697699
// Test case 1: Default behavior (undefined return) should trigger refetch
698700
const optionsDefault = queryCollectionOptions(configDefault)
701+
702+
// Call sync to force the query to be created
703+
optionsDefault.sync.sync({
704+
begin: () => {},
705+
write: () => {},
706+
commit: () => {},
707+
collection: {
708+
subscriberCount: 1,
709+
on: () => {
710+
return () => {}
711+
},
712+
},
713+
} as any)
714+
699715
await optionsDefault.onInsert!(insertMockParams)
700716

701717
// Verify handler was called and refetch was triggered

0 commit comments

Comments
 (0)