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:
1 parent
5a964e6439
commit
ffd6234356
50 files changed
+1038
-1619
No files matched your search
@@ -20,17 +20,13 @@ describe("Line Item - Sales Channel", () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
try {
|
||||
const [process, connection] = await startServerWithEnvironment({
|
||||
cwd,
|
||||
env: { MEDUSA_FF_SALES_CHANNELS: true },
|
||||
verbose: false,
|
||||
})
|
||||
dbConnection = connection
|
||||
medusaProcess = process
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
const [process, connection] = await startServerWithEnvironment({
|
||||
cwd,
|
||||
env: { MEDUSA_FF_SALES_CHANNELS: true },
|
||||
verbose: false,
|
||||
})
|
||||
dbConnection = connection
|
||||
medusaProcess = process
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -40,53 +36,48 @@ describe("Line Item - Sales Channel", () => {
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await simpleProductFactory(dbConnection, {
|
||||
id: "test-product-in-sales-channel",
|
||||
title: "test product belonging to a channel",
|
||||
sales_channels: [
|
||||
{
|
||||
id: "main-sales-channel",
|
||||
name: "Main sales channel",
|
||||
description: "Main sales channel",
|
||||
is_disabled: false,
|
||||
},
|
||||
],
|
||||
variants: [
|
||||
{
|
||||
id: "test-variant-sales-channel",
|
||||
title: "test variant in sales channel",
|
||||
product_id: "test-product-in-sales-channel",
|
||||
inventory_quantity: 1000,
|
||||
prices: [
|
||||
{
|
||||
currency: "usd",
|
||||
amount: 59,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
await simpleProductFactory(dbConnection, {
|
||||
id: "test-product-no-sales-channel",
|
||||
variants: [
|
||||
{
|
||||
id: "test-variant-no-sales-channel",
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
await simpleCartFactory(dbConnection, {
|
||||
id: "test-cart-with-sales-channel",
|
||||
sales_channel: {
|
||||
await simpleProductFactory(dbConnection, {
|
||||
id: "test-product-in-sales-channel",
|
||||
title: "test product belonging to a channel",
|
||||
sales_channels: [
|
||||
{
|
||||
id: "main-sales-channel",
|
||||
name: "Main sales channel",
|
||||
description: "Main sales channel",
|
||||
is_disabled: false,
|
||||
},
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
],
|
||||
variants: [
|
||||
{
|
||||
id: "test-variant-sales-channel",
|
||||
title: "test variant in sales channel",
|
||||
product_id: "test-product-in-sales-channel",
|
||||
inventory_quantity: 1000,
|
||||
prices: [
|
||||
{
|
||||
currency: "usd",
|
||||
amount: 59,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
await simpleProductFactory(dbConnection, {
|
||||
id: "test-product-no-sales-channel",
|
||||
variants: [
|
||||
{
|
||||
id: "test-variant-no-sales-channel",
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
await simpleCartFactory(dbConnection, {
|
||||
id: "test-cart-with-sales-channel",
|
||||
sales_channel: {
|
||||
id: "main-sales-channel",
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
@@ -22,12 +22,8 @@ describe("Line Item Adjustments", () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
try {
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -41,60 +37,55 @@ describe("Line Item Adjustments", () => {
|
||||
discount,
|
||||
lineItemId = "line-test"
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await cartSeeder(dbConnection)
|
||||
discount = await simpleDiscountFactory(dbConnection, {
|
||||
code: "MEDUSATEST",
|
||||
id: "discount-test",
|
||||
rule: {
|
||||
value: 100,
|
||||
type: "fixed",
|
||||
allocation: "total",
|
||||
},
|
||||
regions: ["test-region"],
|
||||
})
|
||||
cart = await simpleCartFactory(
|
||||
dbConnection,
|
||||
{
|
||||
customer: "test-customer",
|
||||
id: "cart-test",
|
||||
line_items: [
|
||||
{
|
||||
id: lineItemId,
|
||||
variant_id: "test-variant",
|
||||
cart_id: "cart-test",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
adjustments: [
|
||||
{
|
||||
amount: 10,
|
||||
discount_id: discount.id,
|
||||
description: "discount",
|
||||
item_id: lineItemId,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
region: "test-region",
|
||||
shipping_address: {
|
||||
address_1: "test",
|
||||
country_code: "us",
|
||||
first_name: "chris",
|
||||
last_name: "rock",
|
||||
postal_code: "101",
|
||||
await cartSeeder(dbConnection)
|
||||
discount = await simpleDiscountFactory(dbConnection, {
|
||||
code: "MEDUSATEST",
|
||||
id: "discount-test",
|
||||
rule: {
|
||||
value: 100,
|
||||
type: "fixed",
|
||||
allocation: "total",
|
||||
},
|
||||
regions: ["test-region"],
|
||||
})
|
||||
cart = await simpleCartFactory(
|
||||
dbConnection,
|
||||
{
|
||||
customer: "test-customer",
|
||||
id: "cart-test",
|
||||
line_items: [
|
||||
{
|
||||
id: lineItemId,
|
||||
variant_id: "test-variant",
|
||||
cart_id: "cart-test",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
adjustments: [
|
||||
{
|
||||
amount: 10,
|
||||
discount_id: discount.id,
|
||||
description: "discount",
|
||||
item_id: lineItemId,
|
||||
},
|
||||
],
|
||||
},
|
||||
shipping_methods: [
|
||||
{
|
||||
shipping_option: "test-option",
|
||||
},
|
||||
],
|
||||
],
|
||||
region: "test-region",
|
||||
shipping_address: {
|
||||
address_1: "test",
|
||||
country_code: "us",
|
||||
first_name: "chris",
|
||||
last_name: "rock",
|
||||
postal_code: "101",
|
||||
},
|
||||
100
|
||||
)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
shipping_methods: [
|
||||
{
|
||||
shipping_option: "test-option",
|
||||
},
|
||||
],
|
||||
},
|
||||
100
|
||||
)
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
Reference in new issue
Block a user