From b79ae006030419ed13c4fe64937cc4606aa756f8 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 25 Jul 2022 16:56:45 -0400 Subject: [PATCH] test: adds like query partial word match test --- test/collections-rest/int.spec.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/collections-rest/int.spec.ts b/test/collections-rest/int.spec.ts index 81218b0cd..9f964fabe 100644 --- a/test/collections-rest/int.spec.ts +++ b/test/collections-rest/int.spec.ts @@ -357,7 +357,7 @@ describe('collections-rest', () => { it('like', async () => { const post1 = await createPost({ title: 'prefix-value' }); - await createPost(); + const { status, result } = await client.find({ query: { title: { @@ -371,6 +371,22 @@ describe('collections-rest', () => { expect(result.totalDocs).toEqual(1); }); + it('like - partial word match', async () => { + const post = await createPost({ title: 'separate words should partially match' }); + + const { status, result } = await client.find({ + query: { + title: { + like: 'words partial', + }, + }, + }); + + expect(status).toEqual(200); + expect(result.docs).toEqual([post]); + expect(result.totalDocs).toEqual(1); + }); + it('exists - true', async () => { const postWithDesc = await createPost({ description: 'exists' }); await createPost({ description: undefined });