Remove lucene from viewV2 tests
This commit is contained in:
parent
08a9488194
commit
718a2a4d87
|
@ -35,8 +35,7 @@ import { quotas } from "@budibase/pro"
|
||||||
import { db, roles, features } from "@budibase/backend-core"
|
import { db, roles, features } from "@budibase/backend-core"
|
||||||
|
|
||||||
describe.each([
|
describe.each([
|
||||||
["lucene", undefined],
|
["internal", undefined],
|
||||||
["sqs", undefined],
|
|
||||||
[DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)],
|
[DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)],
|
||||||
[DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)],
|
[DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)],
|
||||||
[DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)],
|
[DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)],
|
||||||
|
@ -44,13 +43,10 @@ describe.each([
|
||||||
[DatabaseName.ORACLE, getDatasource(DatabaseName.ORACLE)],
|
[DatabaseName.ORACLE, getDatasource(DatabaseName.ORACLE)],
|
||||||
])("/v2/views (%s)", (name, dsProvider) => {
|
])("/v2/views (%s)", (name, dsProvider) => {
|
||||||
const config = setup.getConfig()
|
const config = setup.getConfig()
|
||||||
const isSqs = name === "sqs"
|
const isInternal = name === "internal"
|
||||||
const isLucene = name === "lucene"
|
|
||||||
const isInternal = isSqs || isLucene
|
|
||||||
|
|
||||||
let table: Table
|
let table: Table
|
||||||
let datasource: Datasource
|
let datasource: Datasource
|
||||||
let envCleanup: (() => void) | undefined
|
|
||||||
|
|
||||||
function saveTableRequest(
|
function saveTableRequest(
|
||||||
...overrides: Partial<Omit<SaveTableRequest, "name">>[]
|
...overrides: Partial<Omit<SaveTableRequest, "name">>[]
|
||||||
|
@ -97,14 +93,6 @@ describe.each([
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await features.testutils.withFeatureFlags("*", { SQS: isSqs }, () =>
|
|
||||||
config.init()
|
|
||||||
)
|
|
||||||
|
|
||||||
envCleanup = features.testutils.setFeatureFlags("*", {
|
|
||||||
SQS: isSqs,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (dsProvider) {
|
if (dsProvider) {
|
||||||
datasource = await config.createDatasource({
|
datasource = await config.createDatasource({
|
||||||
datasource: await dsProvider,
|
datasource: await dsProvider,
|
||||||
|
@ -115,9 +103,6 @@ describe.each([
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
setup.afterAll()
|
setup.afterAll()
|
||||||
if (envCleanup) {
|
|
||||||
envCleanup()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -738,7 +723,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
!isLucene &&
|
|
||||||
it("does not get confused when a calculation field shadows a basic one", async () => {
|
it("does not get confused when a calculation field shadows a basic one", async () => {
|
||||||
const table = await config.api.table.save(
|
const table = await config.api.table.save(
|
||||||
saveTableRequest({
|
saveTableRequest({
|
||||||
|
@ -1153,7 +1137,6 @@ describe.each([
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
!isLucene &&
|
|
||||||
describe("calculation views", () => {
|
describe("calculation views", () => {
|
||||||
let table: Table
|
let table: Table
|
||||||
let view: ViewV2
|
let view: ViewV2
|
||||||
|
@ -2484,9 +2467,6 @@ describe.each([
|
||||||
hasNextPage: false,
|
hasNextPage: false,
|
||||||
totalRows: 10,
|
totalRows: 10,
|
||||||
}
|
}
|
||||||
if (isLucene) {
|
|
||||||
expectation.bookmark = expect.anything()
|
|
||||||
}
|
|
||||||
expect(page3).toEqual(expectation)
|
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])(
|
it.each([true, false])(
|
||||||
"can filter a view without a view filter",
|
"can filter a view without a view filter",
|
||||||
async allOr => {
|
async allOr => {
|
||||||
|
@ -2841,7 +2775,6 @@ describe.each([
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
!isLucene &&
|
|
||||||
it.each([true, false])("cannot bypass a view filter", async allOr => {
|
it.each([true, false])("cannot bypass a view filter", async allOr => {
|
||||||
await config.api.row.save(table._id!, {
|
await config.api.row.save(table._id!, {
|
||||||
one: "foo",
|
one: "foo",
|
||||||
|
@ -3041,7 +2974,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
!isLucene &&
|
|
||||||
describe("calculations", () => {
|
describe("calculations", () => {
|
||||||
let table: Table
|
let table: Table
|
||||||
let rows: Row[]
|
let rows: Row[]
|
||||||
|
@ -3163,10 +3095,7 @@ describe.each([
|
||||||
query: {},
|
query: {},
|
||||||
})
|
})
|
||||||
|
|
||||||
function calculate(
|
function calculate(type: CalculationType, numbers: number[]): number {
|
||||||
type: CalculationType,
|
|
||||||
numbers: number[]
|
|
||||||
): number {
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CalculationType.COUNT:
|
case CalculationType.COUNT:
|
||||||
return numbers.length
|
return numbers.length
|
||||||
|
@ -3501,7 +3430,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
!isLucene &&
|
|
||||||
it("should not need required fields to be present", async () => {
|
it("should not need required fields to be present", async () => {
|
||||||
const table = await config.api.table.save(
|
const table = await config.api.table.save(
|
||||||
saveTableRequest({
|
saveTableRequest({
|
||||||
|
|
Loading…
Reference in New Issue