Add tests
This commit is contained in:
parent
22d9b930fc
commit
00c12b9686
|
@ -2769,6 +2769,37 @@ describe.each([
|
|||
},
|
||||
}).toFindNothing()
|
||||
})
|
||||
|
||||
it("validates conditions that are not objects", async () => {
|
||||
await expect(
|
||||
expectQuery({
|
||||
$and: {
|
||||
conditions: [{ equal: { age: 10 } }, "invalidCondition" as any],
|
||||
},
|
||||
}).toFindNothing()
|
||||
).rejects.toThrow(
|
||||
'Invalid body - "query.$and.conditions[1]" must be of type object'
|
||||
)
|
||||
})
|
||||
|
||||
it("validates $and without conditions", async () => {
|
||||
await expect(
|
||||
expectQuery({
|
||||
$and: {
|
||||
conditions: [
|
||||
{ equal: { age: 10 } },
|
||||
{
|
||||
$and: {
|
||||
conditions: undefined as any,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}).toFindNothing()
|
||||
).rejects.toThrow(
|
||||
'Invalid body - "query.$and.conditions[1].$and.conditions" is required'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
!isLucene &&
|
||||
|
|
Loading…
Reference in New Issue