Some fixes based on test runs.
This commit is contained in:
parent
4959a491d7
commit
514f9a1210
|
@ -1,4 +1,12 @@
|
||||||
jest.mock("../../../utilities/fileSystem/utilities")
|
jest.mock("@budibase/backend-core", () => {
|
||||||
|
const core = jest.requireActual("@budibase/backend-core")
|
||||||
|
return {
|
||||||
|
...core,
|
||||||
|
objectStore: {
|
||||||
|
budibaseTempDir: core.objectStore.budibaseTempDir,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
|
const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
|
||||||
const setup = require("./utilities")
|
const setup = require("./utilities")
|
||||||
|
|
|
@ -154,7 +154,7 @@ describe("Authorization middleware", () => {
|
||||||
_id: ""
|
_id: ""
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
config.setMiddlewareRequiredPermission(PermissionType.ADMIN, PermissionLevel.BASIC)
|
config.setMiddlewareRequiredPermission(permissions.PermissionType.ADMIN, permissions.PermissionLevel.BASIC)
|
||||||
|
|
||||||
await config.executeMiddleware()
|
await config.executeMiddleware()
|
||||||
expect(config.throw).toHaveBeenCalledWith(403, "User does not have permission")
|
expect(config.throw).toHaveBeenCalledWith(403, "User does not have permission")
|
||||||
|
|
|
@ -52,7 +52,7 @@ export function processAutoColumn(
|
||||||
user: User | null,
|
user: User | null,
|
||||||
table: Table,
|
table: Table,
|
||||||
row: Row,
|
row: Row,
|
||||||
opts: AutoColumnProcessingOpts
|
opts?: AutoColumnProcessingOpts
|
||||||
) {
|
) {
|
||||||
let noUser = !user || !user.userId
|
let noUser = !user || !user.userId
|
||||||
let isUserTable = table._id === InternalTables.USER_METADATA
|
let isUserTable = table._id === InternalTables.USER_METADATA
|
||||||
|
@ -61,7 +61,7 @@ export function processAutoColumn(
|
||||||
const creating = !row._rev
|
const creating = !row._rev
|
||||||
// check its not user table, or whether any of the processing options have been disabled
|
// check its not user table, or whether any of the processing options have been disabled
|
||||||
const shouldUpdateUserFields =
|
const shouldUpdateUserFields =
|
||||||
!isUserTable && !opts.reprocessing && !opts.noAutoRelationships && !noUser
|
!isUserTable && !opts?.reprocessing && !opts?.noAutoRelationships && !noUser
|
||||||
for (let [key, schema] of Object.entries(table.schema)) {
|
for (let [key, schema] of Object.entries(table.schema)) {
|
||||||
if (!schema.autocolumn) {
|
if (!schema.autocolumn) {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue