Add validateExistingTableImport _id support test

This commit is contained in:
Adria Navarro 2024-07-31 14:17:51 +02:00
parent 5896e94e56
commit 9d0fdeff68
1 changed files with 32 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import { context, events } from "@budibase/backend-core"
import { context, docIds, events } from "@budibase/backend-core"
import {
AutoFieldSubType,
BBReferenceFieldSubType,
@ -1078,6 +1078,37 @@ describe.each([
},
})
})
isInternal &&
it("can reimport _id fields for internal tables", async () => {
const table = await config.api.table.save(
tableForDatasource(datasource, {
primary: ["id"],
schema: basicSchema,
})
)
const result = await config.api.table.validateExistingTableImport({
tableId: table._id,
rows: [
{
_id: docIds.generateRowID(table._id!),
id: generator.natural(),
name: generator.first(),
},
],
})
expect(result).toEqual({
allValid: true,
errors: {},
invalidColumns: [],
schemaValidation: {
_id: true,
id: true,
name: true,
},
})
})
})
})
})