Skip to content

Commit 970bcbf

Browse files
test: added unit and api test cases for equalTo operator
1 parent 043f9fc commit 970bcbf

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

test/api/entry-queryables.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ describe('Query Operators API test cases', () => {
9494

9595
}
9696
});
97+
98+
it('should return entry equal to the condition - equalTo', async () => {
99+
const query = await makeEntries('contenttype_uid').query().equalTo('title', 'value').find<TEntry>();
100+
101+
if (query.entries) {
102+
expect(query.entries[0]._version).toBeDefined();
103+
expect(query.entries[0].locale).toBeDefined();
104+
expect(query.entries[0].uid).toBeDefined();
105+
expect(query.entries[0].title).toBe('value');
106+
}
107+
});
97108
});
98109

99110
function makeEntries(contentTypeUid = ''): Entries {

test/unit/entry-queryable.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ describe('Query Operators API test cases', () => {
4343
const query = await contentType.Entry().query().and(query1, query2);
4444
expect(query._parameters).toStrictEqual({ '$and': [ {'fieldUID': {'$in': ['value']}}, { 'fieldUID': 'value2' } ] });
4545
});
46+
it('should return entry equal to the condition - equalTo', async () => {
47+
const query = contentType.Entry().query().equalTo('fieldUID', 'value');
48+
expect(query._parameters).toStrictEqual({ 'fieldUID': 'value' });
49+
});
4650
});

0 commit comments

Comments
 (0)