Remove get from delete tests
This commit is contained in:
parent
76f89e10d3
commit
56ee61d76c
|
@ -127,11 +127,15 @@ describe("/v2/views", () => {
|
|||
})
|
||||
|
||||
it("can delete an existing view", async () => {
|
||||
await config.api.viewV2.get(view.id, { expectStatus: 200 })
|
||||
const tableId = config.table!._id!
|
||||
const getPersistedView = async () =>
|
||||
(await config.api.table.get(tableId)).views![view.name]
|
||||
|
||||
await config.api.viewV2.delete(config.table?._id!, view.id)
|
||||
expect(await getPersistedView()).toBeDefined()
|
||||
|
||||
await config.api.viewV2.get(view.id, { expectStatus: 404 })
|
||||
await config.api.viewV2.delete(tableId, view.id)
|
||||
|
||||
expect(await getPersistedView()).toBeUndefined()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
import TestConfiguration from "../TestConfiguration"
|
||||
import { TableAPI } from "./table"
|
||||
import { ViewV2API } from "./viewV2"
|
||||
|
||||
export default class API {
|
||||
table: TableAPI
|
||||
viewV2: ViewV2API
|
||||
|
||||
constructor(config: TestConfiguration) {
|
||||
this.table = new TableAPI(config)
|
||||
this.viewV2 = new ViewV2API(config)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import { Table } from "@budibase/types"
|
||||
import TestConfiguration from "../TestConfiguration"
|
||||
import { TestAPI } from "./base"
|
||||
|
||||
export class TableAPI extends TestAPI {
|
||||
constructor(config: TestConfiguration) {
|
||||
super(config)
|
||||
}
|
||||
|
||||
get = async (
|
||||
tableId: string,
|
||||
{ expectStatus } = { expectStatus: 200 }
|
||||
): Promise<Table> => {
|
||||
const res = await this.request
|
||||
.get(`/api/tables/${tableId}`)
|
||||
.set(this.config.defaultHeaders())
|
||||
.expect("Content-Type", /json/)
|
||||
.expect(expectStatus)
|
||||
return res.body
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue