chore(integration): throw errors on catch blocks (#2091)

Why:
Suppressing errors and not failing the execution will lead to misleading errors of the following tests.

Fixes CORE-461
This commit is contained in:
Carlos R. L. Rodrigues
2022-08-25 03:36:24 -03:00
committed by GitHub
parent 5a964e6439
commit ffd6234356
50 changed files with 1038 additions and 1619 deletions

View File

@@ -28,13 +28,8 @@ describe("/admin/draft-orders", () => {
describe("POST /admin/draft-orders", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection)
} catch (err) {
console.log(err)
throw err
}
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection)
})
afterEach(async () => {
@@ -359,7 +354,7 @@ describe("/admin/draft-orders", () => {
const payload = {
email: "oli@test.dk",
shipping_address: "oli-shipping",
discounts: [{ code: "TEST" }, { code: "free-shipping"}],
discounts: [{ code: "TEST" }, { code: "free-shipping" }],
items: [
{
variant_id: "test-variant",
@@ -426,7 +421,7 @@ describe("/admin/draft-orders", () => {
}),
expect.objectContaining({
code: "free-shipping",
})
}),
])
)
})
@@ -524,12 +519,8 @@ describe("/admin/draft-orders", () => {
})
describe("GET /admin/draft-orders", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection)
} catch (err) {
throw err
}
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection)
})
afterEach(async () => {
@@ -605,13 +596,8 @@ describe("/admin/draft-orders", () => {
describe("DELETE /admin/draft-orders/:id", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection)
} catch (err) {
console.log(err)
throw err
}
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection)
})
afterEach(async () => {
@@ -644,12 +630,8 @@ describe("/admin/draft-orders", () => {
describe("POST /admin/draft-orders/:id/line-items/:line_id", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection, { status: "open" })
} catch (err) {
throw err
}
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection, { status: "open" })
})
afterEach(async () => {
@@ -733,12 +715,8 @@ describe("/admin/draft-orders", () => {
describe("POST /admin/draft-orders/:id", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection, { status: "open" })
} catch (err) {
throw err
}
await adminSeeder(dbConnection)
await draftOrderSeeder(dbConnection, { status: "open" })
})
afterEach(async () => {