fixed all integration tests
This commit is contained in:
parent
6450d28a24
commit
b2267322cc
|
@ -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",
|
||||
|
|
|
@ -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()
|
||||
})
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 => {
|
||||
|
|
Loading…
Reference in New Issue