Skip to content

Commit d32eb52

Browse files
authored
test: actually provide a matching query as stated in test title (#50)
* test: actually provide a matching query as stated in test title * test: await nextTick before emitting updated event
1 parent c3f8a7d commit d32eb52

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/useFind.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('Find composition', () => {
319319
expect(findComposition && findComposition.data.value).toContainEqual(changedTestModel);
320320
});
321321

322-
it('should listen to "patch" & "update" events when query is matching', () => {
322+
it('should listen to "patch" & "update" events when query is matching', async () => {
323323
expect.assertions(2);
324324

325325
// given
@@ -336,15 +336,16 @@ describe('Find composition', () => {
336336
const useFind = useFindOriginal(feathersMock);
337337
let findComposition = null as UseFind<TestModel> | null;
338338
mountComposition(() => {
339-
findComposition = useFind('testModels', ref({ query: { mood: 'please-do-not-match' } }));
339+
findComposition = useFind('testModels', ref({ query: { mood: changedTestModel.mood } }));
340340
});
341+
await nextTick();
341342

342343
// when
343344
emitter.emit('updated', changedTestModel);
344345

345346
// then
346347
expect(findComposition).toBeTruthy();
347-
expect(findComposition && findComposition.data.value).not.toContainEqual(changedTestModel);
348+
expect(findComposition && findComposition.data.value).toContainEqual(changedTestModel);
348349
});
349350

350351
it('should ignore "patch" & "update" events when query is not matching', async () => {

0 commit comments

Comments
 (0)