diff --git a/packages/server/src/api/routes/tests/__snapshots__/datasource.spec.js.snap b/packages/server/src/api/routes/tests/__snapshots__/datasource.spec.js.snap index 89d860b4ef..287605cdd6 100644 --- a/packages/server/src/api/routes/tests/__snapshots__/datasource.spec.js.snap +++ b/packages/server/src/api/routes/tests/__snapshots__/datasource.spec.js.snap @@ -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", diff --git a/packages/server/src/api/routes/tests/datasource.spec.js b/packages/server/src/api/routes/tests/datasource.spec.js index 7926925ccb..0f6b4128f9 100644 --- a/packages/server/src/api/routes/tests/datasource.spec.js +++ b/packages/server/src/api/routes/tests/datasource.spec.js @@ -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() }) diff --git a/packages/server/src/api/routes/tests/row.spec.js b/packages/server/src/api/routes/tests/row.spec.js index 3e26915744..9515384608 100644 --- a/packages/server/src/api/routes/tests/row.spec.js +++ b/packages/server/src/api/routes/tests/row.spec.js @@ -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, diff --git a/packages/server/src/api/routes/tests/utilities/TestFunctions.js b/packages/server/src/api/routes/tests/utilities/TestFunctions.js index dabb3ab40c..3ba5b4d694 100644 --- a/packages/server/src/api/routes/tests/utilities/TestFunctions.js +++ b/packages/server/src/api/routes/tests/utilities/TestFunctions.js @@ -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 => {