diff --git a/test/collections-graphql/int.spec.ts b/test/collections-graphql/int.spec.ts index c894cf0638..ea71f6bc25 100644 --- a/test/collections-graphql/int.spec.ts +++ b/test/collections-graphql/int.spec.ts @@ -173,8 +173,9 @@ describe('collections-graphql', () => { const response = await client.request(query); const { docs } = response.Posts; + const docsWithWhereTitleNotEqualPostTitle = docs.filter((post) => post.title === post1.title); - expect(docs[0]).toMatchObject({ id: post2.id, title: post2.title }); + expect(docsWithWhereTitleNotEqualPostTitle).toHaveLength(0); }); it('like', async () => { @@ -261,14 +262,14 @@ describe('collections-graphql', () => { docs { id title + number } } }`; const response = await client.request(query); const { docs } = response.Posts; - - expect(docs).toContainEqual(expect.objectContaining({ id: numPost2.id })); + expect(docs.map(({ id }) => id)).toContain(numPost2.id); }); it('greater_than_equal', async () => { diff --git a/test/collections-rest/int.spec.ts b/test/collections-rest/int.spec.ts index 480df3a630..97f55e1715 100644 --- a/test/collections-rest/int.spec.ts +++ b/test/collections-rest/int.spec.ts @@ -289,7 +289,15 @@ describe('collections-rest', () => { expect(foundDoc.id).toEqual(doc.id); }); - it('should query', async () => { + it('should query - equals', async () => { + const customId = `custom-${randomBytes(32).toString('hex').slice(0, 12)}`; + const { doc } = await client.create({ slug: customIdSlug, data: { id: customId, name: 'custom-id-name' } }); + const { result } = await client.find({ slug: customIdSlug, query: { id: { equals: customId } } }); + + expect(result.docs.map(({ id }) => id)).toContain(doc.id); + }); + + it('should query - like', async () => { const customId = `custom-${randomBytes(32).toString('hex').slice(0, 12)}`; const { doc } = await client.create({ slug: customIdSlug, data: { id: customId, name: 'custom-id-name' } }); const { result } = await client.find({ slug: customIdSlug, query: { id: { like: 'custom' } } });