1
0
Fork 0
mirror of synced 2024-07-09 00:06:05 +12:00

Fix viewV2 tests (for now)

This commit is contained in:
Sam Rose 2024-04-08 15:17:24 +01:00
parent 81cd2a1559
commit d2c0842c45
No known key found for this signature in database
3 changed files with 8 additions and 12 deletions

View file

@ -6,6 +6,7 @@ import {
UIFieldMetadata,
UpdateViewRequest,
ViewResponse,
ViewResponseEnriched,
ViewV2,
} from "@budibase/types"
import { builderSocket, gridSocket } from "../../../websockets"
@ -39,9 +40,9 @@ async function parseSchema(view: CreateViewRequest) {
return finalViewSchema
}
export async function get(ctx: Ctx<void, ViewResponse>) {
export async function get(ctx: Ctx<void, ViewResponseEnriched>) {
ctx.body = {
data: await sdk.views.get(ctx.params.viewId),
data: await sdk.views.getEnriched(ctx.params.viewId),
}
}

View file

@ -8,7 +8,6 @@ import {
import { db as dbCore } from "@budibase/backend-core"
import { cloneDeep } from "lodash"
import sdk from "../../../sdk"
import * as utils from "../../../db/utils"
import { isExternalTableID } from "../../../integrations/utils"
@ -64,10 +63,6 @@ export function enrichSchema(
view: ViewV2,
tableSchema: TableSchema
): ViewV2Enriched {
if (!sdk.views.isV2(view)) {
return view
}
let schema = cloneDeep(tableSchema)
const anyViewOrder = Object.values(view.schema || {}).some(
ui => ui.order != null

View file

@ -4,9 +4,9 @@ import {
ViewV2,
SearchViewRowRequest,
PaginatedSearchRowResponse,
ViewV2Enriched,
} from "@budibase/types"
import { Expectations, TestAPI } from "./base"
import sdk from "../../../sdk"
export class ViewV2API extends TestAPI {
create = async (
@ -44,10 +44,10 @@ export class ViewV2API extends TestAPI {
return await this._delete(`/api/v2/views/${viewId}`, { expectations: exp })
}
get = async (viewId: string, expectations?: Expectations) => {
return await this._get<ViewV2Enriched>(`/api/v2/views/${viewId}`, {
expectations,
})
get = async (viewId: string) => {
return await this.config.doInContext(this.config.getAppId(), () =>
sdk.views.get(viewId)
)
}
search = async (