Merge branch 'v3-ui' of github.com:Budibase/budibase into v3-ui
This commit is contained in:
commit
be27bdba66
|
@ -136,16 +136,15 @@ export async function importToRows(
|
|||
|
||||
// We use a reference to table here and update it after input processing,
|
||||
// so that we can auto increment auto IDs in imported data properly
|
||||
const processed = await inputProcessing(userId, table, row, {
|
||||
row = await inputProcessing(userId, table, row, {
|
||||
noAutoRelationships: true,
|
||||
})
|
||||
row = processed
|
||||
|
||||
// However here we must reference the original table, as we want to mutate
|
||||
// the real schema of the table passed in, not the clone used for
|
||||
// incrementing auto IDs
|
||||
for (const [fieldName, schema] of Object.entries(originalTable.schema)) {
|
||||
if (schema.type === FieldType.LINK) {
|
||||
if (schema.type === FieldType.LINK && data.find(row => row[fieldName])) {
|
||||
throw new HTTPError(
|
||||
`Can't bulk import relationship fields for internal databases, found value in field "${fieldName}"`,
|
||||
400
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { DEFAULT_TABLES } from "../../../db/defaultData/datasource_bb_default"
|
||||
|
||||
jest.mock("../../../utilities/redis", () => ({
|
||||
init: jest.fn(),
|
||||
getLocksById: () => {
|
||||
|
@ -447,4 +449,18 @@ describe("/applications", () => {
|
|||
expect(devLogs.data.length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe("POST /api/applications/:appId/sample", () => {
|
||||
it("should be able to add sample data", async () => {
|
||||
await config.api.application.addSampleData(config.getAppId())
|
||||
for (let table of DEFAULT_TABLES) {
|
||||
const res = await config.api.row.search(
|
||||
table._id!,
|
||||
{ query: {} },
|
||||
{ status: 200 }
|
||||
)
|
||||
expect(res.rows.length).not.toEqual(0)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue