Tests
This commit is contained in:
parent
54c285f71c
commit
63ffc81ffe
|
@ -1,3 +1,12 @@
|
||||||
|
import * as permissionSdk from "../../../sdk/app/permissions"
|
||||||
|
jest.mock(
|
||||||
|
"../../../sdk/app/permissions",
|
||||||
|
(): jest.Mocked<typeof permissionSdk> => ({
|
||||||
|
resourceActionAllowed: jest.fn(),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
const mockedSdk = permissionSdk as jest.Mocked<typeof permissionSdk>
|
||||||
|
|
||||||
import { roles } from "@budibase/backend-core"
|
import { roles } from "@budibase/backend-core"
|
||||||
import { Document, Row, Table } from "@budibase/types"
|
import { Document, Row, Table } from "@budibase/types"
|
||||||
import * as setup from "./utilities"
|
import * as setup from "./utilities"
|
||||||
|
@ -22,6 +31,8 @@ describe("/permission", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
mockedSdk.resourceActionAllowed.mockResolvedValue({ allowed: true })
|
||||||
|
|
||||||
table = (await config.createTable()) as typeof table
|
table = (await config.createTable()) as typeof table
|
||||||
row = await config.createRow()
|
row = await config.createRow()
|
||||||
perms = await config.addPermission(STD_ROLE_ID, table._id)
|
perms = await config.addPermission(STD_ROLE_ID, table._id)
|
||||||
|
|
Loading…
Reference in New Issue