diff --git a/test/unit/upgradeDBTest.js b/test/unit/upgradeDBTest.js index 6789933a..797ed5b2 100644 --- a/test/unit/upgradeDBTest.js +++ b/test/unit/upgradeDBTest.js @@ -569,7 +569,7 @@ describe('Upgrade DB Tests', () => { it('should not create duplicate roles if they already exist', async () => { // Create an existing role - await new RoleModel({ name: 'admin' }).save() + await new RoleModel({name: 'admin'}).save() await upgradeFunc() @@ -583,9 +583,9 @@ describe('Upgrade DB Tests', () => { it('should set correct permissions for each role', async () => { await upgradeFunc() - const managerRole = await RoleModel.findOne({ name: 'manager' }) - const adminRole = await RoleModel.findOne({ name: 'admin' }) - const operatorRole = await RoleModel.findOne({ name: 'operator' }) + const managerRole = await RoleModel.findOne({name: 'manager'}) + const adminRole = await RoleModel.findOne({name: 'admin'}) + const operatorRole = await RoleModel.findOne({name: 'operator'}) // Helper function to check permissions const checkPermissions = (role, expectedPermissions) => { @@ -600,55 +600,55 @@ describe('Upgrade DB Tests', () => { // Admin role permissions checkPermissions(adminRole, { - "channel-view-all": true, - "channel-manage-all": true, - "client-view-all": true, - "client-manage-all": true, - "transaction-view-all": true, - "transaction-view-body-all": true, - "transaction-rerun-all": true, - "user-view": true, - "user-manage": true, - "visualizer-manage": true, - "visualizer-view": true + 'channel-view-all': true, + 'channel-manage-all': true, + 'client-view-all': true, + 'client-manage-all': true, + 'transaction-view-all': true, + 'transaction-view-body-all': true, + 'transaction-rerun-all': true, + 'user-view': true, + 'user-manage': true, + 'visualizer-manage': true, + 'visualizer-view': true // Add other admin permissions as needed }) // Manager role permissions checkPermissions(managerRole, { - "channel-view-all": true, - "channel-manage-all": true, - "client-view-all": true, - "client-manage-all": true, - "transaction-view-all": true, - "transaction-view-body-all": true, - "transaction-rerun-all": true, - "user-view": true, - "visualizer-manage": true, - "visualizer-view": true + 'channel-view-all': true, + 'channel-manage-all': true, + 'client-view-all': true, + 'client-manage-all': true, + 'transaction-view-all': true, + 'transaction-view-body-all': true, + 'transaction-rerun-all': true, + 'user-view': true, + 'visualizer-manage': true, + 'visualizer-view': true // Add other manager permissions as needed }) // Operator role permissions checkPermissions(operatorRole, { - "channel-view-all": true, - "transaction-view-all": true, - "transaction-view-body-all": true, - "transaction-rerun-all": true + 'channel-view-all': true, + 'transaction-view-all': true, + 'transaction-view-body-all': true, + 'transaction-rerun-all': true // Add other operator permissions as needed }) // Check that operator doesn't have certain permissions - should(operatorRole.permissions["user-manage"]).be.false() - should(operatorRole.permissions["client-manage-all"]).be.false() + should(operatorRole.permissions['user-manage']).be.false() + should(operatorRole.permissions['client-manage-all']).be.false() }) it('should not create roles if they all already exist', async () => { // Create all default roles beforehand await Promise.all([ - new RoleModel({ name: 'admin' }).save(), - new RoleModel({ name: 'manager' }).save(), - new RoleModel({ name: 'operator' }).save() + new RoleModel({name: 'admin'}).save(), + new RoleModel({name: 'manager'}).save(), + new RoleModel({name: 'operator'}).save() ]) await upgradeFunc() @@ -659,7 +659,7 @@ describe('Upgrade DB Tests', () => { it('should handle partial existing roles', async () => { // Create only one default role beforehand - await new RoleModel({ name: 'admin' }).save() + await new RoleModel({name: 'admin'}).save() await upgradeFunc() @@ -671,4 +671,4 @@ describe('Upgrade DB Tests', () => { roleNames.should.containEql('operator') }) }) -}) \ No newline at end of file +})