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:
committed by
GitHub
parent
5a964e6439
commit
ffd6234356
@@ -52,15 +52,11 @@ describe("sales channels", () => {
|
||||
let salesChannel
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -92,19 +88,15 @@ describe("sales channels", () => {
|
||||
let salesChannel2
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel1 = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
salesChannel2 = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name 2",
|
||||
description: "test description 2",
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel1 = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
salesChannel2 = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name 2",
|
||||
description: "test description 2",
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -207,15 +199,11 @@ describe("sales channels", () => {
|
||||
let sc
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
sc = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
await adminSeeder(dbConnection)
|
||||
sc = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -256,11 +244,7 @@ describe("sales channels", () => {
|
||||
|
||||
describe("POST /admin/sales-channels", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
await adminSeeder(dbConnection)
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -324,21 +308,17 @@ describe("sales channels", () => {
|
||||
let salesChannel
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
|
||||
await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "Default channel",
|
||||
id: "test-channel",
|
||||
is_default: true,
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "Default channel",
|
||||
id: "test-channel",
|
||||
is_default: true,
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -454,18 +434,14 @@ describe("sales channels", () => {
|
||||
describe("GET /admin/orders/:id", () => {
|
||||
let order
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
|
||||
order = await simpleOrderFactory(dbConnection, {
|
||||
sales_channel: {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
},
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
order = await simpleOrderFactory(dbConnection, {
|
||||
sales_channel: {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -495,18 +471,14 @@ describe("sales channels", () => {
|
||||
|
||||
describe("GET /admin/orders?expand=sales_channels", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
|
||||
await simpleOrderFactory(dbConnection, {
|
||||
sales_channel: {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
},
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
await simpleOrderFactory(dbConnection, {
|
||||
sales_channel: {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -537,24 +509,20 @@ describe("sales channels", () => {
|
||||
describe("GET /admin/product/:id", () => {
|
||||
let product
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
|
||||
product = await simpleProductFactory(dbConnection, {
|
||||
sales_channels: [
|
||||
{
|
||||
name: "webshop",
|
||||
description: "Webshop sales channel",
|
||||
},
|
||||
{
|
||||
name: "amazon",
|
||||
description: "Amazon sales channel",
|
||||
},
|
||||
],
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
product = await simpleProductFactory(dbConnection, {
|
||||
sales_channels: [
|
||||
{
|
||||
name: "webshop",
|
||||
description: "Webshop sales channel",
|
||||
},
|
||||
{
|
||||
name: "amazon",
|
||||
description: "Amazon sales channel",
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -589,24 +557,20 @@ describe("sales channels", () => {
|
||||
|
||||
describe("GET /admin/products?expand[]=sales_channels", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
|
||||
await simpleProductFactory(dbConnection, {
|
||||
sales_channels: [
|
||||
{
|
||||
name: "webshop",
|
||||
description: "Webshop sales channel",
|
||||
},
|
||||
{
|
||||
name: "amazon",
|
||||
description: "Amazon sales channel",
|
||||
},
|
||||
],
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
await simpleProductFactory(dbConnection, {
|
||||
sales_channels: [
|
||||
{
|
||||
name: "webshop",
|
||||
description: "Webshop sales channel",
|
||||
},
|
||||
{
|
||||
name: "amazon",
|
||||
description: "Amazon sales channel",
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -645,20 +609,16 @@ describe("sales channels", () => {
|
||||
let product
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
product = await simpleProductFactory(dbConnection, {
|
||||
id: "product_1",
|
||||
title: "test title",
|
||||
})
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
products: [product],
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
await adminSeeder(dbConnection)
|
||||
product = await simpleProductFactory(dbConnection, {
|
||||
id: "product_1",
|
||||
title: "test title",
|
||||
})
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
products: [product],
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -730,19 +690,15 @@ describe("sales channels", () => {
|
||||
let product
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
product = await simpleProductFactory(dbConnection, {
|
||||
id: "product_1",
|
||||
title: "test title",
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
product = await simpleProductFactory(dbConnection, {
|
||||
id: "product_1",
|
||||
title: "test title",
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -798,19 +754,14 @@ describe("sales channels", () => {
|
||||
let order
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
order = await simpleOrderFactory(dbConnection, {
|
||||
sales_channel: {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
},
|
||||
})
|
||||
await orderSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
await adminSeeder(dbConnection)
|
||||
order = await simpleOrderFactory(dbConnection, {
|
||||
sales_channel: {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
},
|
||||
})
|
||||
await orderSeeder(dbConnection)
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -850,19 +801,14 @@ describe("sales channels", () => {
|
||||
let salesChannel
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await productSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
const product = await simpleProductFactory(dbConnection, productData)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
products: [product],
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
await productSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
const product = await simpleProductFactory(dbConnection, productData)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
products: [product],
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -900,17 +846,12 @@ describe("sales channels", () => {
|
||||
let salesChannel
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await productSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
await productSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -965,17 +906,12 @@ describe("sales channels", () => {
|
||||
let salesChannel
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await productSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
await productSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
salesChannel = await simpleSalesChannelFactory(dbConnection, {
|
||||
name: "test name",
|
||||
description: "test description",
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
Reference in New Issue
Block a user