test: adds like query partial word match test
This commit is contained in:
@@ -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<Post>({
|
||||
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<Post>({
|
||||
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 });
|
||||
|
||||
Reference in New Issue
Block a user