chore(medusa): Typeorm upgrade to 0.3.11 (#3041)
This commit is contained in:
@@ -470,7 +470,7 @@ describe("/admin/order-edits", () => {
|
||||
withDeleted: true,
|
||||
})
|
||||
|
||||
expect(orderEdit).toBeUndefined()
|
||||
expect(orderEdit).toBeNull()
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data).toEqual({
|
||||
id,
|
||||
@@ -534,7 +534,7 @@ describe("/admin/order-edits", () => {
|
||||
withDeleted: true,
|
||||
})
|
||||
|
||||
expect(orderEdit).toBeUndefined()
|
||||
expect(orderEdit).toBeNull()
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data).toEqual({
|
||||
id: orderEditId,
|
||||
|
||||
@@ -2123,7 +2123,9 @@ describe("/admin/orders", () => {
|
||||
|
||||
const manager = dbConnection.manager
|
||||
const customOptions = await manager.find(CustomShippingOption, {
|
||||
shipping_option_id: "test-option",
|
||||
where: {
|
||||
shipping_option_id: "test-option",
|
||||
},
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
@@ -23,7 +23,7 @@ const adminReqConfig = {
|
||||
},
|
||||
}
|
||||
|
||||
jest.setTimeout(30000)
|
||||
jest.setTimeout(50000)
|
||||
|
||||
describe("/admin/price-lists", () => {
|
||||
let medusaProcess
|
||||
@@ -1108,52 +1108,66 @@ describe("/admin/price-lists", () => {
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.count).toEqual(2)
|
||||
expect(response.data.products).toHaveLength(2)
|
||||
expect(response.data.products).toEqual([
|
||||
expect.objectContaining({
|
||||
id: "test-prod-2",
|
||||
variants: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "test-variant-3",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({ currency_code: "usd", amount: 100 }),
|
||||
]),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "test-variant-4",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({ currency_code: "usd", amount: 100 }),
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 150,
|
||||
price_list_id: "test-list",
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "test-prod-1",
|
||||
variants: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "test-variant-1",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({ currency_code: "usd", amount: 100 }),
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 150,
|
||||
price_list_id: "test-list",
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "test-variant-2",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({ currency_code: "usd", amount: 100 }),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
])
|
||||
expect(response.data.products).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "test-prod-1",
|
||||
variants: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "test-variant-1",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 100,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 150,
|
||||
price_list_id: "test-list",
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "test-variant-2",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 100,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "test-prod-2",
|
||||
variants: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "test-variant-3",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 100,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "test-variant-4",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 100,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 150,
|
||||
price_list_id: "test-list",
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it("lists only product 2", async () => {
|
||||
|
||||
@@ -2142,7 +2142,6 @@ describe("/admin/products", () => {
|
||||
const variant = response.data.product.variants.find(
|
||||
(v) => v.id === variantId
|
||||
)
|
||||
|
||||
expect(variant.prices.length).toEqual(data.prices.length)
|
||||
|
||||
expect(variant.prices).toEqual(
|
||||
@@ -2467,10 +2466,10 @@ describe("/admin/products", () => {
|
||||
const api = useApi()
|
||||
|
||||
const variantPre = await dbConnection.manager.findOne(ProductVariant, {
|
||||
id: "test-variant",
|
||||
where: { id: "test-variant" },
|
||||
})
|
||||
|
||||
expect(variantPre).not.toEqual(undefined)
|
||||
expect(variantPre).toBeTruthy()
|
||||
|
||||
const response = await api
|
||||
.delete("/admin/products/test-product", adminHeaders)
|
||||
@@ -2488,10 +2487,10 @@ describe("/admin/products", () => {
|
||||
)
|
||||
|
||||
const variant = await dbConnection.manager.findOne(ProductVariant, {
|
||||
id: "test-variant",
|
||||
where: { id: "test-variant" },
|
||||
})
|
||||
|
||||
expect(variant).toEqual(undefined)
|
||||
expect(variant).not.toBeTruthy()
|
||||
})
|
||||
|
||||
it("successfully deletes a product variant and its associated option values", async () => {
|
||||
@@ -2499,10 +2498,10 @@ describe("/admin/products", () => {
|
||||
|
||||
// Validate that the option value exists
|
||||
const optValPre = await dbConnection.manager.findOne(ProductOptionValue, {
|
||||
variant_id: "test-variant_2",
|
||||
where: { variant_id: "test-variant_2" },
|
||||
})
|
||||
|
||||
expect(optValPre).not.toEqual(undefined)
|
||||
expect(optValPre).toBeTruthy()
|
||||
|
||||
// Soft delete the variant
|
||||
const response = await api.delete(
|
||||
@@ -2515,20 +2514,18 @@ describe("/admin/products", () => {
|
||||
// Validate that the option value was deleted
|
||||
const optValPost = await dbConnection.manager.findOne(
|
||||
ProductOptionValue,
|
||||
{
|
||||
variant_id: "test-variant_2",
|
||||
}
|
||||
{ where: { variant_id: "test-variant_2" } }
|
||||
)
|
||||
|
||||
expect(optValPost).toEqual(undefined)
|
||||
expect(optValPost).not.toBeTruthy()
|
||||
|
||||
// Validate that the option still exists in the DB with deleted_at
|
||||
const optValDeleted = await dbConnection.manager.findOne(
|
||||
ProductOptionValue,
|
||||
{
|
||||
variant_id: "test-variant_2",
|
||||
},
|
||||
{
|
||||
where: {
|
||||
variant_id: "test-variant_2",
|
||||
},
|
||||
withDeleted: true,
|
||||
}
|
||||
)
|
||||
@@ -2546,10 +2543,10 @@ describe("/admin/products", () => {
|
||||
|
||||
// Validate that the option value exists
|
||||
const optValPre = await dbConnection.manager.findOne(ProductOptionValue, {
|
||||
variant_id: "test-variant_2",
|
||||
where: { variant_id: "test-variant_2" },
|
||||
})
|
||||
|
||||
expect(optValPre).not.toEqual(undefined)
|
||||
expect(optValPre).toBeTruthy()
|
||||
|
||||
// Soft delete the product
|
||||
const response = await api.delete(
|
||||
@@ -2563,19 +2560,19 @@ describe("/admin/products", () => {
|
||||
const optValPost = await dbConnection.manager.findOne(
|
||||
ProductOptionValue,
|
||||
{
|
||||
variant_id: "test-variant_2",
|
||||
where: { variant_id: "test-variant_2" },
|
||||
}
|
||||
)
|
||||
|
||||
expect(optValPost).toEqual(undefined)
|
||||
expect(optValPost).not.toBeTruthy()
|
||||
|
||||
// Validate that the option still exists in the DB with deleted_at
|
||||
const optValDeleted = await dbConnection.manager.findOne(
|
||||
ProductOptionValue,
|
||||
{
|
||||
variant_id: "test-variant_2",
|
||||
},
|
||||
{
|
||||
where: {
|
||||
variant_id: "test-variant_2",
|
||||
},
|
||||
withDeleted: true,
|
||||
}
|
||||
)
|
||||
@@ -2593,10 +2590,10 @@ describe("/admin/products", () => {
|
||||
|
||||
// Validate that the price exists
|
||||
const pricePre = await dbConnection.manager.findOne(MoneyAmount, {
|
||||
id: "test-price",
|
||||
where: { id: "test-price" },
|
||||
})
|
||||
|
||||
expect(pricePre).not.toEqual(undefined)
|
||||
expect(pricePre).toBeTruthy()
|
||||
|
||||
// Soft delete the variant
|
||||
const response = await api.delete(
|
||||
@@ -2608,21 +2605,18 @@ describe("/admin/products", () => {
|
||||
|
||||
// Validate that the price was deleted
|
||||
const pricePost = await dbConnection.manager.findOne(MoneyAmount, {
|
||||
id: "test-price",
|
||||
where: { id: "test-price" },
|
||||
})
|
||||
|
||||
expect(pricePost).toEqual(undefined)
|
||||
expect(pricePost).not.toBeTruthy()
|
||||
|
||||
// Validate that the price still exists in the DB with deleted_at
|
||||
const optValDeleted = await dbConnection.manager.findOne(
|
||||
MoneyAmount,
|
||||
{
|
||||
const optValDeleted = await dbConnection.manager.findOne(MoneyAmount, {
|
||||
where: {
|
||||
id: "test-price",
|
||||
},
|
||||
{
|
||||
withDeleted: true,
|
||||
}
|
||||
)
|
||||
withDeleted: true,
|
||||
})
|
||||
|
||||
expect(optValDeleted).toEqual(
|
||||
expect.objectContaining({
|
||||
@@ -2637,10 +2631,10 @@ describe("/admin/products", () => {
|
||||
|
||||
// Validate that the price exists
|
||||
const pricePre = await dbConnection.manager.findOne(MoneyAmount, {
|
||||
id: "test-price",
|
||||
where: { id: "test-price" },
|
||||
})
|
||||
|
||||
expect(pricePre).not.toEqual(undefined)
|
||||
expect(pricePre).toBeTruthy()
|
||||
|
||||
// Soft delete the product
|
||||
const response = await api.delete(
|
||||
@@ -2652,21 +2646,18 @@ describe("/admin/products", () => {
|
||||
|
||||
// Validate that the price has been deleted
|
||||
const pricePost = await dbConnection.manager.findOne(MoneyAmount, {
|
||||
id: "test-price",
|
||||
where: { id: "test-price" },
|
||||
})
|
||||
|
||||
expect(pricePost).toEqual(undefined)
|
||||
expect(pricePost).not.toBeTruthy()
|
||||
|
||||
// Validate that the price still exists in the DB with deleted_at
|
||||
const optValDeleted = await dbConnection.manager.findOne(
|
||||
MoneyAmount,
|
||||
{
|
||||
const optValDeleted = await dbConnection.manager.findOne(MoneyAmount, {
|
||||
where: {
|
||||
id: "test-price",
|
||||
},
|
||||
{
|
||||
withDeleted: true,
|
||||
}
|
||||
)
|
||||
withDeleted: true,
|
||||
})
|
||||
|
||||
expect(optValDeleted).toEqual(
|
||||
expect.objectContaining({
|
||||
|
||||
@@ -92,7 +92,7 @@ describe("/admin/shipping-options", () => {
|
||||
)
|
||||
})
|
||||
|
||||
it("fails as it is not allowed to set id from client side", async () => {
|
||||
it("fails to add a a requirement with an id if it does not exists", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const payload = {
|
||||
@@ -123,7 +123,9 @@ describe("/admin/shipping-options", () => {
|
||||
})
|
||||
|
||||
expect(res.status).toEqual(400)
|
||||
expect(res.data.message).toEqual("ID does not exist")
|
||||
expect(res.data.message).toEqual(
|
||||
"Shipping option requirement with id not_allowed does not exist"
|
||||
)
|
||||
})
|
||||
|
||||
it("it successfully updates a set of existing requirements", async () => {
|
||||
@@ -274,7 +276,9 @@ describe("/admin/shipping-options", () => {
|
||||
|
||||
const manager = dbConnection.manager
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
where: {
|
||||
type: ShippingProfile.default,
|
||||
},
|
||||
})
|
||||
|
||||
payload = {
|
||||
@@ -521,7 +525,9 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/shipping-options", () => {
|
||||
const defaultProfile = await dbConnection.manager.findOne(
|
||||
ShippingProfile,
|
||||
{
|
||||
type: "default",
|
||||
where: {
|
||||
type: ShippingProfile.default,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -75,7 +75,9 @@ describe("/admin/store", () => {
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
|
||||
const manager = dbConnection.manager
|
||||
const store = await manager.findOne(Store, { name: "Medusa Store" })
|
||||
const store = await manager.findOne(Store, {
|
||||
where: { name: "Medusa Store" },
|
||||
})
|
||||
await manager.query(
|
||||
`INSERT INTO store_currencies (store_id, currency_code) VALUES ('${store.id}', 'dkk')`
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user