mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-10 01:16:39 +02:00
fix: add missing awaits (#1472)
* refactor: silence expected console.error call * fix: add missing access service awaits * fix: add missing constraint validation await
This commit is contained in:
parent
1da38781d5
commit
9f7d878422
@ -181,7 +181,7 @@ export class AccessStore implements IAccessStore {
|
|||||||
environment: permission.environment,
|
environment: permission.environment,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.db.batchInsert(T.ROLE_PERMISSION, rows);
|
await this.db.batchInsert(T.ROLE_PERMISSION, rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
async unlinkUserRoles(userId: number): Promise<void> {
|
async unlinkUserRoles(userId: number): Promise<void> {
|
||||||
|
@ -2,6 +2,14 @@ import knex from 'knex';
|
|||||||
import EventStore from './event-store';
|
import EventStore from './event-store';
|
||||||
import getLogger from '../../test/fixtures/no-logger';
|
import getLogger from '../../test/fixtures/no-logger';
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
getLogger.setMuteError(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
getLogger.setMuteError(false);
|
||||||
|
});
|
||||||
|
|
||||||
test('Trying to get events if db fails should yield empty list', async () => {
|
test('Trying to get events if db fails should yield empty list', async () => {
|
||||||
const db = knex({
|
const db = knex({
|
||||||
client: 'pg',
|
client: 'pg',
|
||||||
|
@ -406,7 +406,7 @@ export class AccessService {
|
|||||||
const rolePermissions = role.permissions;
|
const rolePermissions = role.permissions;
|
||||||
const newRole = await this.roleStore.create(baseRole);
|
const newRole = await this.roleStore.create(baseRole);
|
||||||
if (rolePermissions) {
|
if (rolePermissions) {
|
||||||
this.store.addEnvironmentPermissionsToRole(
|
await this.store.addEnvironmentPermissionsToRole(
|
||||||
newRole.id,
|
newRole.id,
|
||||||
rolePermissions,
|
rolePermissions,
|
||||||
);
|
);
|
||||||
@ -425,8 +425,8 @@ export class AccessService {
|
|||||||
const rolePermissions = role.permissions;
|
const rolePermissions = role.permissions;
|
||||||
const newRole = await this.roleStore.update(baseRole);
|
const newRole = await this.roleStore.update(baseRole);
|
||||||
if (rolePermissions) {
|
if (rolePermissions) {
|
||||||
this.store.wipePermissionsFromRole(newRole.id);
|
await this.store.wipePermissionsFromRole(newRole.id);
|
||||||
this.store.addEnvironmentPermissionsToRole(
|
await this.store.addEnvironmentPermissionsToRole(
|
||||||
newRole.id,
|
newRole.id,
|
||||||
rolePermissions,
|
rolePermissions,
|
||||||
);
|
);
|
||||||
|
@ -197,7 +197,7 @@ class FeatureToggleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (oneOf(DATE_OPERATORS, operator)) {
|
if (oneOf(DATE_OPERATORS, operator)) {
|
||||||
validateDate(constraint.value);
|
await validateDate(constraint.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user