Skip to content

Commit 84aac0d

Browse files
committed
test: await on all expectations which should resolve/reject
1 parent 28c3897 commit 84aac0d

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

src/roles/integration.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ requireAtLeast(
335335
await client.users.db.assignRoles('landlord', 'Innkeeper');
336336

337337
const assignments = await client.roles.userAssignments('landlord');
338-
339338
expect(assignments).toEqual(
340339
expect.arrayContaining([
341340
expect.objectContaining<UserAssignment>({ id: 'custom-user', userType: 'db_env_user' }),

src/users/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const db = (connection: ConnectionREST): DBUsers => {
106106
return error.code === code;
107107
}
108108
throw error;
109-
}
109+
};
110110
};
111111

112112
type APIKeyResponse = { apikey: string };
@@ -178,7 +178,8 @@ const namespacedUsers = (connection: ConnectionREST): NamespacedUsers => {
178178
getAssignedRoles: (userType: UserTypeInternal, userId: string, opts?: GetAssignedRolesOptions) =>
179179
connection
180180
.get<WeaviateRole[]>(
181-
`/authz/users/${userId}/roles/${userType}${opts?.includePermissions ? '?&includeFullRoles=true' : ''
181+
`/authz/users/${userId}/roles/${userType}${
182+
opts?.includePermissions ? '?&includeFullRoles=true' : ''
182183
}`
183184
)
184185
.then(Map.roles),

src/users/integration.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ requireAtLeast(
7676
};
7777

7878
await client.users.db.create('dynamic-dave');
79-
expectDave().toHaveProperty('active', true);
79+
await expectDave().toHaveProperty('active', true);
8080

8181
// Second activation is a no-op
82-
expect(client.users.db.activate('dynamic-dave')).resolves.toEqual(true);
82+
await expect(client.users.db.activate('dynamic-dave')).resolves.toEqual(true);
8383

8484
await client.users.db.deactivate('dynamic-dave');
85-
expectDave().toHaveProperty('active', false);
85+
await expectDave().toHaveProperty('active', false);
8686

8787
// Second deactivation is a no-op
88-
expect(client.users.db.deactivate('dynamic-dave')).resolves.toEqual(true);
88+
await expect(client.users.db.deactivate('dynamic-dave')).resolves.toEqual(true);
8989

9090
await client.users.db.delete('dynamic-dave');
91-
expectDave(false).toHaveProperty('code', 404);
91+
await expectDave(false).toHaveProperty('code', 404);
9292
});
9393

9494
it('should be able to obtain and rotate api keys', async () => {
@@ -128,12 +128,12 @@ requireAtLeast(
128128
}
129129

130130
await admin.users[kind].assignRoles('test', 'role-rick');
131-
expect(admin.users[kind].getAssignedRoles('role-rick')).resolves.toEqual(
131+
await expect(admin.users[kind].getAssignedRoles('role-rick')).resolves.toEqual(
132132
expect.objectContaining({ test: expect.any(Object) })
133133
);
134134

135135
await admin.users[kind].revokeRoles('test', 'role-rick');
136-
expect(admin.users[kind].getAssignedRoles('role-rick')).resolves.toEqual({});
136+
await expect(admin.users[kind].getAssignedRoles('role-rick')).resolves.toEqual({});
137137
});
138138

139139
it('should be able to fetch assigned roles with all permissions', async () => {

src/users/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ export type GetAssignedRolesOptions = {
2020

2121
/** Optional arguments to /assign and /revoke endpoints. */
2222
export type AssignRevokeOptions = { userType?: WeaviateUserTypeInternal };
23-

0 commit comments

Comments
 (0)