Test both allOr and allAnd

This commit is contained in:
Adria Navarro 2024-08-21 12:14:40 +02:00
parent 53e01aa241
commit c5476ce3b3
1 changed files with 75 additions and 66 deletions

View File

@ -1493,7 +1493,9 @@ describe.each([
})
isLucene &&
it("in lucene, cannot override a view filter", async () => {
it.each([true, false])(
"in lucene, cannot override a view filter",
async allOr => {
await config.api.row.save(table._id!, {
one: "foo",
two: "bar",
@ -1522,6 +1524,7 @@ describe.each([
const response = await config.api.viewV2.search(view.id, {
query: {
allOr,
equal: {
two: "bar",
},
@ -1531,10 +1534,13 @@ describe.each([
expect(response.rows).toEqual([
expect.objectContaining({ _id: two._id }),
])
})
}
)
!isLucene &&
it("can filter a view without a view filter", async () => {
it.each([true, false])(
"can filter a view without a view filter",
async allOr => {
const one = await config.api.row.save(table._id!, {
one: "foo",
two: "bar",
@ -1556,6 +1562,7 @@ describe.each([
const response = await config.api.viewV2.search(view.id, {
query: {
allOr,
equal: {
two: "bar",
},
@ -1565,10 +1572,11 @@ describe.each([
expect(response.rows).toEqual([
expect.objectContaining({ _id: one._id }),
])
})
}
)
!isLucene &&
it("cannot bypass a view filter", async () => {
it.each([true, false])("cannot bypass a view filter", async allOr => {
await config.api.row.save(table._id!, {
one: "foo",
two: "bar",
@ -1597,6 +1605,7 @@ describe.each([
const response = await config.api.viewV2.search(view.id, {
query: {
allOr,
equal: {
two: "bar",
},