Skip to content

Commit 5d7348b

Browse files
committed
Add ObjectID findByFields test
1 parent fdc5744 commit 5d7348b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/__tests__/cache.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ describe('createCachingMethods', () => {
152152
expect(collection.find.mock.calls.length).toBe(1)
153153
})
154154

155+
it('finds by ObjectID field', async () => {
156+
const foundDocs = await api.findByFields({ _id: ObjectId(hexId) })
157+
158+
expect(foundDocs[0]).toBe(docs.one)
159+
expect(foundDocs.length).toBe(1)
160+
161+
expect(collection.find.mock.calls.length).toBe(1)
162+
})
163+
155164
it('finds by array field', async () => {
156165
const foundDocs = await api.findByFields({ tags: 'bar' })
157166

0 commit comments

Comments
 (0)