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
1 changed files with 43 additions and 1 deletions

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", () => {