Legacy views tests

This commit is contained in:
Adria Navarro 2023-09-08 10:43:19 +02:00
parent 93e9b1b8b4
commit 9e799c6b93
2 changed files with 57 additions and 49 deletions

View File

@ -710,9 +710,11 @@ describe.each([
})
})
// Legacy views are not available for external
isInternal &&
describe("fetchView", () => {
it("should be able to fetch tables contents via 'view'", async () => {
const row = await config.createRow()
const row = await createRow()
const rowUsage = await getRowUsage()
const queryUsage = await getQueryUsage()
@ -741,8 +743,13 @@ describe.each([
})
it("should be able to run on a view", async () => {
const view = await config.createLegacyView()
const row = await config.createRow()
const view = await config.createLegacyView({
tableId: table._id!,
name: "ViewTest",
filters: [],
schema: {},
})
const row = await createRow()
const rowUsage = await getRowUsage()
const queryUsage = await getQueryUsage()

View File

@ -50,6 +50,7 @@ import {
SearchFilters,
UserRoles,
Automation,
View,
} from "@budibase/types"
import API from "./api"
@ -629,12 +630,12 @@ class TestConfiguration {
// VIEW
async createLegacyView(config?: any) {
if (!this.table) {
async createLegacyView(config?: View) {
if (!this.table && !config) {
throw "Test requires table to be configured."
}
const view = config || {
tableId: this.table._id,
tableId: this.table!._id,
name: "ViewTest",
}
return this._req(view, null, controllers.view.v1.save)