Add extra tests

This commit is contained in:
Adria Navarro 2024-10-11 12:20:04 +02:00
parent b125a7c599
commit cb78e0bc13
1 changed files with 41 additions and 0 deletions

View File

@ -2329,6 +2329,47 @@ describe.each([
equal: { ["name"]: "baz" },
}).toContainExactly([{ name: "baz", productCat: undefined }])
})
describe("logical filters", () => {
it("should allow nested ands with single conditions", async () => {
await expectQuery({
$and: {
conditions: [
{
$and: {
conditions: [
{
equal: { ["productCat.name"]: "foo" },
},
],
},
},
],
},
}).toContainExactly([
{ name: "foo", productCat: [{ _id: productCatRows[0]._id }] },
])
})
it("should allow nested ands with exclusive conditions", async () => {
await expectQuery({
$and: {
conditions: [
{
$and: {
conditions: [
{
equal: { ["productCat.name"]: "foo" },
notEqual: { ["productCat.name"]: "foo" },
},
],
},
},
],
},
}).toContainExactly([])
})
})
})
isSql &&