Skip to content

Commit

Permalink
bug-fix: minor
Browse files Browse the repository at this point in the history
  • Loading branch information
k1ch committed Nov 8, 2024
1 parent 1d755f4 commit b8ccfd9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions database/test/db-admin-rolepermissions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ describe('Admin role permissions view', () => {
validRoleKey = roleKey
const { key: permissionKey } = await usherDb('permissions').select('key').where({ clientkey: clientKey }).first()
validPermissionKey = permissionKey
await usherDb('rolepermissions').where({ rolekey: validRoleKey }).del()
})

it('Should return an array of inserted rolepermissions records', async () => {
const [rolePermission] = await adminRolePermissions.insertRolePermissions(validRoleKey, [validPermissionKey])
assert.ok(!!rolePermission)
assert.equal(rolePermission.rolekey, validRoleKey)
assert.equal(rolePermission.permissionkey, validPermissionKey)
const rolePermissions = await adminRolePermissions.insertRolePermissions(validRoleKey, [validPermissionKey])
assert.equal(rolePermissions.length, 1)
assert.equal(rolePermissions[0].rolekey, validRoleKey)
assert.equal(rolePermissions[0].permissionkey, validPermissionKey)
})

it('Should ignore the duplicate permission keys', async () => {
Expand Down Expand Up @@ -72,7 +73,7 @@ describe('Admin role permissions view', () => {
})

afterEach(async () => {
await usherDb('rolepermissions').where({ rolekey: validRoleKey, permissionkey: validPermissionKey }).del()
await usherDb('rolepermissions').where({ rolekey: validRoleKey }).del()
})
})

Expand Down

0 comments on commit b8ccfd9

Please sign in to comment.