1
0
Fork 0
mirror of synced 2024-08-09 15:17:57 +12:00

Create a failing test for BUDI-7552

This commit is contained in:
Sam Rose 2023-10-11 11:07:46 +01:00
parent 1825412568
commit 4bda97d70f

View file

@ -1,4 +1,3 @@
import { generator } from "@budibase/backend-core/tests"
import { events, context } from "@budibase/backend-core"
import { FieldType, Table, ViewCalculation } from "@budibase/types"
import { checkBuilderEndpoint } from "./utilities/TestFunctions"
@ -182,6 +181,49 @@ describe("/tables", () => {
1
)
})
it("should update Auto ID field after bulk import", async () => {
const table = await config.createTable({
name: "TestTable",
type: "table",
schema: {
autoId: {
name: "id",
type: FieldType.NUMBER,
subtype: "autoID",
autocolumn: true,
constraints: {
type: "number",
presence: false,
},
},
},
})
let response = await request
.post(`/api/${table._id}/rows`)
.send({})
.set(config.defaultHeaders())
.expect(200)
expect(response.body.autoId).toEqual(1)
await request
.post(`/api/tables/${table._id}/import`)
.send({
rows: [{ autoId: 2 }],
})
.set(config.defaultHeaders())
.expect(200)
response = await request
.post(`/api/${table._id}/rows`)
.send({})
.set(config.defaultHeaders())
.expect(200)
expect(response.body.autoId).toEqual(3)
})
})
describe("fetch", () => {