chore(medusa): Typeorm upgrade to 0.3.11 (#3041)

This commit is contained in:
Riqwan Thamir
2023-02-15 16:25:30 +01:00
committed by GitHub
parent 8137061908
commit 121b42acfe
275 changed files with 4493 additions and 4780 deletions
@@ -59,6 +59,7 @@ Object {
"title": "Test variant",
"upc": "test-upc",
"updated_at": Any<String>,
"variant_rank": 0,
"weight": null,
"width": null,
},
@@ -150,6 +151,7 @@ Object {
"title": "Test variant",
"upc": "test-upc",
"updated_at": Any<String>,
"variant_rank": 0,
"weight": null,
"width": null,
},
@@ -216,6 +218,7 @@ Object {
"title": "test2",
"upc": null,
"updated_at": Any<String>,
"variant_rank": 0,
"weight": null,
"width": null,
},
@@ -314,6 +317,7 @@ Object {
"title": "Test variant",
"upc": "test-upc",
"updated_at": Any<String>,
"variant_rank": 0,
"weight": null,
"width": null,
},
@@ -380,6 +384,7 @@ Object {
"title": "Test variant",
"upc": "test-upc",
"updated_at": Any<String>,
"variant_rank": 0,
"weight": null,
"width": null,
},
@@ -52,7 +52,9 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] Gift Card - Tax calculations", () =>
includes_tax: true,
})
customer = await simpleCustomerFactory(dbConnection, { password: 'medusatest' })
customer = await simpleCustomerFactory(dbConnection, {
password: "medusatest",
})
customerData = {
email: customer.email,
password: "medusatest",
@@ -64,15 +66,19 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] Gift Card - Tax calculations", () =>
is_giftcard: true,
discountable: false,
options: [{ id: "denom", title: "Denomination" }],
variants: [{
title: "Gift Card",
prices: [{
amount: 30000,
currency: "usd",
region_id: region.id,
}],
options: [{ option_id: "denom", value: "Denomination" }],
}]
variants: [
{
title: "Gift Card",
prices: [
{
amount: 30000,
currency: "usd",
region_id: region.id,
},
],
options: [{ option_id: "denom", value: "Denomination" }],
},
],
})
})
@@ -84,10 +90,12 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] Gift Card - Tax calculations", () =>
const createCartRes = await api.post("/store/carts", {
region_id: region.id,
items: [{
variant_id: product.variants[0].id,
quantity: 1,
}],
items: [
{
variant_id: product.variants[0].id,
quantity: 1,
},
],
})
expect(createCartRes.status).toEqual(200)
@@ -112,8 +120,8 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] Gift Card - Tax calculations", () =>
id: product.variants[0].id,
product: expect.objectContaining({
is_giftcard: true,
})
})
}),
}),
}),
])
)
@@ -142,10 +150,12 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] Gift Card - Tax calculations", () =>
const getCartResponse = await api.get(`/store/carts/${cartFactory.id}`)
const cart = getCartResponse.data.cart
await api.post(`/store/carts/${cart.id}/payment-sessions`)
const createdOrder = await api.post(`/store/carts/${cart.id}/complete-cart`)
const createdOrder = await api.post(
`/store/carts/${cart.id}/complete-cart`
)
const createdGiftCards = await dbConnection.manager.find(GiftCard, {
where: { order_id: createdOrder.data.data.id }
where: { order_id: createdOrder.data.data.id },
})
const createdGiftCard = createdGiftCards[0]
@@ -166,14 +176,18 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] Gift Card - Tax calculations", () =>
tax_rate: region.tax_rate,
})
const expensiveProduct = await simpleProductFactory(dbConnection, {
variants: [{
title: "Product cost higher than gift card balance",
prices: [{
amount: 50000,
currency: "usd",
region_id: region.id,
}],
}]
variants: [
{
title: "Product cost higher than gift card balance",
prices: [
{
amount: 50000,
currency: "usd",
region_id: region.id,
},
],
},
],
})
const customerRes = await api.post("/store/customers", customerData, {
@@ -203,7 +217,9 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] Gift Card - Tax calculations", () =>
const getCartResponse = await api.get(`/store/carts/${cartFactory.id}`)
const cart = getCartResponse.data.cart
await api.post(`/store/carts/${cart.id}/payment-sessions`)
const createdOrder = await api.post(`/store/carts/${cart.id}/complete-cart`)
const createdOrder = await api.post(
`/store/carts/${cart.id}/complete-cart`
)
expect(createdOrder.data.data).toEqual(
expect.objectContaining({
@@ -232,12 +248,12 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] Gift Card - Tax calculations", () =>
refundable: 50000,
tax_lines: expect.arrayContaining([
expect.objectContaining({
rate: 19
})
rate: 19,
}),
]),
})
}),
]),
}),
})
)
})
})
@@ -67,7 +67,9 @@ describe("/store/carts", () => {
})
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: {
type: ShippingProfile.default,
},
})
await manager.insert(Product, {
id: "test-product",
@@ -313,7 +315,7 @@ describe("/store/carts", () => {
MedusaError.Codes.INSUFFICIENT_INVENTORY
)
let payments = await manager.find(Payment, { cart_id: cartId })
let payments = await manager.find(Payment, { where: { cart_id: cartId } })
expect(payments).toHaveLength(1)
expect(payments).toContainEqual(
expect.objectContaining({
@@ -338,7 +340,7 @@ describe("/store/carts", () => {
expect(responseSuccess.status).toEqual(200)
expect(responseSuccess.data.type).toEqual("order")
payments = await manager.find(Payment, { cart_id: cartId })
payments = await manager.find(Payment, { where: { cart_id: cartId } })
expect(payments).toHaveLength(2)
expect(payments).toEqual(
expect.arrayContaining([
@@ -391,7 +393,9 @@ describe("/store/carts", () => {
expect(responseSuccess.status).toEqual(200)
expect(responseSuccess.data.type).toEqual("order")
const payments = await manager.find(Payment, { cart_id: cartId })
const payments = await manager.find(Payment, {
where: { cart_id: cartId },
})
expect(payments).toHaveLength(1)
expect(payments).toContainEqual(
expect.objectContaining({
@@ -48,7 +48,9 @@ describe("/store/carts", () => {
)
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: {
type: ShippingProfile.default,
},
})
await manager.insert(Region, {
@@ -1,5 +1,10 @@
const path = require("path")
const { Region, ShippingProfile, ShippingOption } = require("@medusajs/medusa")
const {
Region,
ShippingProfile,
ShippingOption,
ShippingProfileType,
} = require("@medusajs/medusa")
const setupServer = require("../../../helpers/setup-server")
const { useApi } = require("../../../helpers/use-api")
@@ -60,7 +65,9 @@ describe("/store/shipping-options", () => {
})
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: {
type: ShippingProfileType.DEFAULT,
},
})
await manager.insert(ShippingOption, {
@@ -1,5 +1,9 @@
const path = require("path")
const { ShippingProfile, ShippingOption } = require("@medusajs/medusa")
const {
ShippingProfile,
ShippingOption,
ShippingProfileType,
} = require("@medusajs/medusa")
const setupServer = require("../../../helpers/setup-server")
const { useApi } = require("../../../helpers/use-api")
@@ -38,7 +42,9 @@ describe("/store/carts", () => {
)
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: {
type: ShippingProfileType.DEFAULT,
},
})
await manager.insert(ShippingOption, {
id: "return-option",