Skip to content

Commit

Permalink
don't use await Promise.all in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Sep 28, 2023
1 parent 9f6cb0f commit 482e629
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions packages/cli/test/integration/credentials.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,10 @@ describe('POST /credentials', () => {
});

test('should fail with invalid inputs', async () => {
await Promise.all(
INVALID_PAYLOADS.map(async (invalidPayload) => {
const response = await authOwnerAgent.post('/credentials').send(invalidPayload);
expect(response.statusCode).toBe(400);
}),
);
for (const invalidPayload of INVALID_PAYLOADS) {
const response = await authOwnerAgent.post('/credentials').send(invalidPayload);
expect(response.statusCode).toBe(400);
}
});

test('should fail with missing encryption key', async () => {
Expand Down Expand Up @@ -370,18 +368,16 @@ describe('PATCH /credentials/:id', () => {
test('should fail with invalid inputs', async () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: owner });

await Promise.all(
INVALID_PAYLOADS.map(async (invalidPayload) => {
const response = await authOwnerAgent
.patch(`/credentials/${savedCredential.id}`)
.send(invalidPayload);

if (response.statusCode === 500) {
console.log(response.statusCode, response.body);
}
expect(response.statusCode).toBe(400);
}),
);
for (const invalidPayload of INVALID_PAYLOADS) {
const response = await authOwnerAgent
.patch(`/credentials/${savedCredential.id}`)
.send(invalidPayload);

if (response.statusCode === 500) {
console.log(response.statusCode, response.body);
}
expect(response.statusCode).toBe(400);
}
});

test('should fail if cred not found', async () => {
Expand Down

0 comments on commit 482e629

Please sign in to comment.