Remove lucene from viewV2 tests

This commit is contained in:
Adria Navarro 2024-10-21 15:14:35 +02:00
parent 08a9488194
commit 718a2a4d87
1 changed files with 733 additions and 805 deletions

View File

@ -35,8 +35,7 @@ import { quotas } from "@budibase/pro"
import { db, roles, features } from "@budibase/backend-core"
describe.each([
["lucene", undefined],
["sqs", undefined],
["internal", undefined],
[DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)],
[DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)],
[DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)],
@ -44,13 +43,10 @@ describe.each([
[DatabaseName.ORACLE, getDatasource(DatabaseName.ORACLE)],
])("/v2/views (%s)", (name, dsProvider) => {
const config = setup.getConfig()
const isSqs = name === "sqs"
const isLucene = name === "lucene"
const isInternal = isSqs || isLucene
const isInternal = name === "internal"
let table: Table
let datasource: Datasource
let envCleanup: (() => void) | undefined
function saveTableRequest(
...overrides: Partial<Omit<SaveTableRequest, "name">>[]
@ -97,14 +93,6 @@ describe.each([
}
beforeAll(async () => {
await features.testutils.withFeatureFlags("*", { SQS: isSqs }, () =>
config.init()
)
envCleanup = features.testutils.setFeatureFlags("*", {
SQS: isSqs,
})
if (dsProvider) {
datasource = await config.createDatasource({
datasource: await dsProvider,
@ -115,9 +103,6 @@ describe.each([
afterAll(async () => {
setup.afterAll()
if (envCleanup) {
envCleanup()
}
})
beforeEach(() => {
@ -738,7 +723,6 @@ describe.each([
})
})
!isLucene &&
it("does not get confused when a calculation field shadows a basic one", async () => {
const table = await config.api.table.save(
saveTableRequest({
@ -1153,7 +1137,6 @@ describe.each([
)
})
!isLucene &&
describe("calculation views", () => {
let table: Table
let view: ViewV2
@ -2484,9 +2467,6 @@ describe.each([
hasNextPage: false,
totalRows: 10,
}
if (isLucene) {
expectation.bookmark = expect.anything()
}
expect(page3).toEqual(expectation)
})
@ -2758,52 +2738,6 @@ describe.each([
)
})
isLucene &&
it.each([true, false])(
"in lucene, cannot override a view filter",
async allOr => {
await config.api.row.save(table._id!, {
one: "foo",
two: "bar",
})
const two = await config.api.row.save(table._id!, {
one: "foo2",
two: "bar2",
})
const view = await config.api.viewV2.create({
tableId: table._id!,
name: generator.guid(),
query: [
{
operator: BasicOperator.EQUAL,
field: "two",
value: "bar2",
},
],
schema: {
id: { visible: true },
one: { visible: false },
two: { visible: true },
},
})
const response = await config.api.viewV2.search(view.id, {
query: {
allOr,
equal: {
two: "bar",
},
},
})
expect(response.rows).toHaveLength(1)
expect(response.rows).toEqual([
expect.objectContaining({ _id: two._id }),
])
}
)
!isLucene &&
it.each([true, false])(
"can filter a view without a view filter",
async allOr => {
@ -2841,7 +2775,6 @@ describe.each([
}
)
!isLucene &&
it.each([true, false])("cannot bypass a view filter", async allOr => {
await config.api.row.save(table._id!, {
one: "foo",
@ -3041,7 +2974,6 @@ describe.each([
})
})
!isLucene &&
describe("calculations", () => {
let table: Table
let rows: Row[]
@ -3163,10 +3095,7 @@ describe.each([
query: {},
})
function calculate(
type: CalculationType,
numbers: number[]
): number {
function calculate(type: CalculationType, numbers: number[]): number {
switch (type) {
case CalculationType.COUNT:
return numbers.length
@ -3501,7 +3430,6 @@ describe.each([
})
})
!isLucene &&
it("should not need required fields to be present", async () => {
const table = await config.api.table.save(
saveTableRequest({