1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01: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:
olav 2022-04-01 11:10:21 +02:00 committed by GitHub
parent 1da38781d5
commit 9f7d878422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

View File

@ -181,7 +181,7 @@ export class AccessStore implements IAccessStore {
environment: permission.environment,
};
});
this.db.batchInsert(T.ROLE_PERMISSION, rows);
await this.db.batchInsert(T.ROLE_PERMISSION, rows);
}
async unlinkUserRoles(userId: number): Promise<void> {

View File

@ -2,6 +2,14 @@ import knex from 'knex';
import EventStore from './event-store';
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 () => {
const db = knex({
client: 'pg',

View File

@ -406,7 +406,7 @@ export class AccessService {
const rolePermissions = role.permissions;
const newRole = await this.roleStore.create(baseRole);
if (rolePermissions) {
this.store.addEnvironmentPermissionsToRole(
await this.store.addEnvironmentPermissionsToRole(
newRole.id,
rolePermissions,
);
@ -425,8 +425,8 @@ export class AccessService {
const rolePermissions = role.permissions;
const newRole = await this.roleStore.update(baseRole);
if (rolePermissions) {
this.store.wipePermissionsFromRole(newRole.id);
this.store.addEnvironmentPermissionsToRole(
await this.store.wipePermissionsFromRole(newRole.id);
await this.store.addEnvironmentPermissionsToRole(
newRole.id,
rolePermissions,
);

View File

@ -197,7 +197,7 @@ class FeatureToggleService {
}
if (oneOf(DATE_OPERATORS, operator)) {
validateDate(constraint.value);
await validateDate(constraint.value);
}
if (