fixed all integration tests
This commit is contained in:
parent
47b896cba5
commit
d2bb7ea6ab
|
@ -3,7 +3,6 @@
|
||||||
exports[`/datasources fetch returns all the datasources from the server 1`] = `
|
exports[`/datasources fetch returns all the datasources from the server 1`] = `
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"_id": "bb_internal",
|
|
||||||
"config": Object {},
|
"config": Object {},
|
||||||
"entities": Array [
|
"entities": Array [
|
||||||
Object {
|
Object {
|
||||||
|
@ -81,8 +80,6 @@ Array [
|
||||||
"type": "budibase",
|
"type": "budibase",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"_id": "datasource_f8f81b1f0893478580b863fe96f1f3da",
|
|
||||||
"_rev": "1-1df90f81a2294ba7349f690f4a6df092",
|
|
||||||
"config": Object {},
|
"config": Object {},
|
||||||
"name": "Test",
|
"name": "Test",
|
||||||
"source": "POSTGRES",
|
"source": "POSTGRES",
|
||||||
|
|
|
@ -40,6 +40,13 @@ describe("/datasources", () => {
|
||||||
.expect(200)
|
.expect(200)
|
||||||
|
|
||||||
const datasources = res.body
|
const datasources = res.body
|
||||||
|
|
||||||
|
// remove non-deterministic fields
|
||||||
|
for (let source of datasources) {
|
||||||
|
delete source._id
|
||||||
|
delete source._rev
|
||||||
|
}
|
||||||
|
|
||||||
expect(datasources).toMatchSnapshot()
|
expect(datasources).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -241,19 +241,16 @@ describe("/rows", () => {
|
||||||
it("should be able to delete a row", async () => {
|
it("should be able to delete a row", async () => {
|
||||||
const createdRow = await config.createRow(row)
|
const createdRow = await config.createRow(row)
|
||||||
const res = await request
|
const res = await request
|
||||||
.delete(`/api/${table._id}/rows/${createdRow._id}/${createdRow._rev}`)
|
.delete(`/api/${table._id}/rows`)
|
||||||
|
.send({
|
||||||
|
rows: [
|
||||||
|
createdRow
|
||||||
|
]
|
||||||
|
})
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
.expect(200)
|
.expect(200)
|
||||||
expect(res.body.ok).toEqual(true)
|
expect(res.body[0]._id).toEqual(createdRow._id)
|
||||||
})
|
|
||||||
|
|
||||||
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)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -289,9 +286,8 @@ describe("/rows", () => {
|
||||||
const row1 = await config.createRow()
|
const row1 = await config.createRow()
|
||||||
const row2 = await config.createRow()
|
const row2 = await config.createRow()
|
||||||
const res = await request
|
const res = await request
|
||||||
.post(`/api/${table._id}/rows`)
|
.delete(`/api/${table._id}/rows`)
|
||||||
.send({
|
.send({
|
||||||
type: "delete",
|
|
||||||
rows: [
|
rows: [
|
||||||
row1,
|
row1,
|
||||||
row2,
|
row2,
|
||||||
|
|
|
@ -7,6 +7,7 @@ const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||||
function Request(appId, params) {
|
function Request(appId, params) {
|
||||||
this.appId = appId
|
this.appId = appId
|
||||||
this.params = params
|
this.params = params
|
||||||
|
this.request = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getAllTableRows = async config => {
|
exports.getAllTableRows = async config => {
|
||||||
|
|
Loading…
Reference in New Issue