Skip to content

Commit 0299405

Browse files
committed
refactor(test): use concise Promise.all
1 parent 6731968 commit 0299405

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/users/integration.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ requireAtLeast(
112112
it('should be able to list all dynamic users', async () => {
113113
const admin = await makeClient('admin-key');
114114

115-
const created: Promise<any>[] = [];
116-
for (const user of ['jim', 'pam', 'dwight']) {
117-
created.push(admin.users.db.create(user));
118-
}
119-
await Promise.all(created);
115+
await Promise.all(['jim', 'pam', 'dwight'].map((user) => admin.users.db.create(user)));
120116

121117
const all = await admin.users.db.listAll();
122118
expect(all.length).toBeGreaterThanOrEqual(3);
@@ -147,10 +143,10 @@ requireAtLeast(
147143
});
148144

149145
afterAll(() =>
150-
makeClient('admin-key').then((c) => {
151-
for (const user of ['jim', 'pam', 'dwight', 'dynamic-dave', 'api-ashley', 'role-rick']) {
152-
c.users.db.delete(user);
153-
}
146+
makeClient('admin-key').then(async (c) => {
147+
await Promise.all(
148+
['jim', 'pam', 'dwight', 'dynamic-dave', 'api-ashley', 'role-rick'].map((n) => c.roles.delete(n))
149+
);
154150
})
155151
);
156152
});

0 commit comments

Comments
 (0)