ci: Refactor DB tests (no-changelog) (#7292)

[DB tests](https://github.com/n8n-io/n8n/actions/runs/6340094467)
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-09-28 16:53:05 +02:00
committed by GitHub
parent 0bc33b1cc2
commit cf5a0ca456
4 changed files with 95 additions and 38 deletions

View File

@@ -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 () => {
@@ -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);
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);
}),
);
if (response.statusCode === 500) {
console.log(response.statusCode, response.body);
}
expect(response.statusCode).toBe(400);
}
});
test('should fail if cred not found', async () => {