fixed all integration tests

This commit is contained in:
Martin McKeaveney 2021-06-17 16:52:52 +01:00
parent 6450d28a24
commit b2267322cc
4 changed files with 16 additions and 15 deletions

View File

@ -3,7 +3,6 @@
exports[`/datasources fetch returns all the datasources from the server 1`] = `
Array [
Object {
"_id": "bb_internal",
"config": Object {},
"entities": Array [
Object {
@ -81,8 +80,6 @@ Array [
"type": "budibase",
},
Object {
"_id": "datasource_f8f81b1f0893478580b863fe96f1f3da",
"_rev": "1-1df90f81a2294ba7349f690f4a6df092",
"config": Object {},
"name": "Test",
"source": "POSTGRES",

View File

@ -40,6 +40,13 @@ describe("/datasources", () => {
.expect(200)
const datasources = res.body
// remove non-deterministic fields
for (let source of datasources) {
delete source._id
delete source._rev
}
expect(datasources).toMatchSnapshot()
})

View File

@ -241,19 +241,16 @@ describe("/rows", () => {
it("should be able to delete a row", async () => {
const createdRow = await config.createRow(row)
const res = await request
.delete(`/api/${table._id}/rows/${createdRow._id}/${createdRow._rev}`)
.delete(`/api/${table._id}/rows`)
.send({
rows: [
createdRow
]
})
.set(config.defaultHeaders())
.expect('Content-Type', /json/)
.expect(200)
expect(res.body.ok).toEqual(true)
})
it("shouldn't allow deleting a row in a table which is different to the one the row was created on", async () => {
const createdRow = await config.createRow(row)
await request
.delete(`/api/wrong_table/rows/${createdRow._id}/${createdRow._rev}`)
.set(config.defaultHeaders())
.expect(400)
expect(res.body[0]._id).toEqual(createdRow._id)
})
})
@ -289,9 +286,8 @@ describe("/rows", () => {
const row1 = await config.createRow()
const row2 = await config.createRow()
const res = await request
.post(`/api/${table._id}/rows`)
.delete(`/api/${table._id}/rows`)
.send({
type: "delete",
rows: [
row1,
row2,

View File

@ -7,6 +7,7 @@ const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
function Request(appId, params) {
this.appId = appId
this.params = params
this.request = {}
}
exports.getAllTableRows = async config => {