Fix ViewV2API.get to hit the API instead of using the sdk.
This commit is contained in:
parent
1e5d4f39bf
commit
8ad0729317
|
@ -181,7 +181,7 @@ describe.each([
|
|||
|
||||
const createdView = await config.api.viewV2.create(newView)
|
||||
|
||||
expect(await config.api.viewV2.get(createdView.id)).toEqual({
|
||||
expect(createdView).toEqual({
|
||||
...newView,
|
||||
schema: {
|
||||
Price: {
|
||||
|
@ -398,7 +398,7 @@ describe.each([
|
|||
})
|
||||
|
||||
it("updates only UI schema overrides", async () => {
|
||||
await config.api.viewV2.update({
|
||||
const updatedView = await config.api.viewV2.update({
|
||||
...view,
|
||||
schema: {
|
||||
Price: {
|
||||
|
@ -417,7 +417,7 @@ describe.each([
|
|||
} as Record<string, FieldSchema>,
|
||||
})
|
||||
|
||||
expect(await config.api.viewV2.get(view.id)).toEqual({
|
||||
expect(updatedView).toEqual({
|
||||
...view,
|
||||
schema: {
|
||||
Price: {
|
||||
|
@ -479,17 +479,17 @@ describe.each([
|
|||
|
||||
describe("fetch view (through table)", () => {
|
||||
it("should be able to fetch a view V2", async () => {
|
||||
const newView: CreateViewRequest = {
|
||||
const res = await config.api.viewV2.create({
|
||||
name: generator.name(),
|
||||
tableId: table._id!,
|
||||
schema: {
|
||||
Price: { visible: false },
|
||||
Category: { visible: true },
|
||||
},
|
||||
}
|
||||
const res = await config.api.viewV2.create(newView)
|
||||
})
|
||||
expect(res.schema?.Price).toBeUndefined()
|
||||
|
||||
const view = await config.api.viewV2.get(res.id)
|
||||
expect(view!.schema?.Price).toBeUndefined()
|
||||
const updatedTable = await config.api.table.get(table._id!)
|
||||
const viewSchema = updatedTable.views![view!.name!].schema as Record<
|
||||
string,
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
ViewV2,
|
||||
SearchViewRowRequest,
|
||||
PaginatedSearchRowResponse,
|
||||
ViewResponseEnriched,
|
||||
} from "@budibase/types"
|
||||
import { Expectations, TestAPI } from "./base"
|
||||
import sdk from "../../../sdk"
|
||||
|
@ -45,9 +46,8 @@ export class ViewV2API extends TestAPI {
|
|||
}
|
||||
|
||||
get = async (viewId: string) => {
|
||||
return await this.config.doInContext(this.config.getAppId(), () =>
|
||||
sdk.views.get(viewId)
|
||||
)
|
||||
return (await this._get<ViewResponseEnriched>(`/api/v2/views/${viewId}`))
|
||||
.data
|
||||
}
|
||||
|
||||
search = async (
|
||||
|
|
Loading…
Reference in New Issue