fix: Addresses breaking change from library class-transformer (#835)
Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
59761163c2
commit
f387b4919f
@@ -413,32 +413,34 @@ describe("/admin/orders", () => {
|
||||
it("creates a claim on order with discount", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.post(
|
||||
"/admin/orders/discount-order/claims",
|
||||
{
|
||||
type: "refund",
|
||||
claim_items: [
|
||||
{
|
||||
item_id: "test-item",
|
||||
quantity: 1,
|
||||
reason: "production_failure",
|
||||
tags: ["fluff"],
|
||||
images: ["https://test.image.com"],
|
||||
},
|
||||
],
|
||||
additional_items: [
|
||||
{
|
||||
variant_id: "test-variant",
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
const response = await api
|
||||
.post(
|
||||
"/admin/orders/discount-order/claims",
|
||||
{
|
||||
type: "refund",
|
||||
claim_items: [
|
||||
{
|
||||
item_id: "test-item-1",
|
||||
quantity: 1,
|
||||
reason: "production_failure",
|
||||
tags: ["fluff"],
|
||||
images: ["https://test.image.com"],
|
||||
},
|
||||
],
|
||||
additional_items: [
|
||||
{
|
||||
variant_id: "test-variant",
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
)
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
expect(response.status).toEqual(200)
|
||||
})
|
||||
|
||||
@@ -1226,6 +1228,9 @@ describe("/admin/orders", () => {
|
||||
expect.objectContaining({
|
||||
id: "test-order-w-r",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "discount-order",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -1245,6 +1250,9 @@ describe("/admin/orders", () => {
|
||||
expect.objectContaining({
|
||||
id: "test-order",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "discount-order",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -1299,12 +1307,16 @@ describe("/admin/orders", () => {
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.count).toEqual(1)
|
||||
expect(response.data.count).toEqual(2)
|
||||
expect(response.data.orders).toEqual([
|
||||
expect.objectContaining({
|
||||
id: "test-order",
|
||||
shipping_address: expect.objectContaining({ first_name: "lebron" }),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "discount-order",
|
||||
shipping_address: expect.objectContaining({ first_name: "lebron" }),
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -1338,6 +1350,9 @@ describe("/admin/orders", () => {
|
||||
expect.objectContaining({
|
||||
id: "test-order-w-r",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "discount-order",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -1387,6 +1402,9 @@ describe("/admin/orders", () => {
|
||||
expect.objectContaining({
|
||||
id: "test-order-w-r",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "discount-order",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -1436,6 +1454,9 @@ describe("/admin/orders", () => {
|
||||
expect.objectContaining({
|
||||
id: "test-order-w-r",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "discount-order",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ Object {
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"customer_id": "test-customer",
|
||||
"display_id": 6,
|
||||
"display_id": Any<Number>,
|
||||
"draft_order_id": null,
|
||||
"email": "test@email.com",
|
||||
"fulfillment_status": "fulfilled",
|
||||
|
||||
@@ -212,6 +212,7 @@ describe("/store/carts", () => {
|
||||
],
|
||||
order: {
|
||||
id: "test-order",
|
||||
display_id: expect.any(Number),
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
|
||||
@@ -181,7 +181,6 @@ module.exports = async (connection, data = {}) => {
|
||||
id: "test-method",
|
||||
order_id: "test-order",
|
||||
shipping_option_id: "test-option",
|
||||
order_id: "test-order",
|
||||
price: 1000,
|
||||
data: {},
|
||||
})
|
||||
@@ -357,12 +356,12 @@ module.exports = async (connection, data = {}) => {
|
||||
const discountedOrder = manager.create(Order, {
|
||||
id: "discount-order",
|
||||
customer_id: "test-customer",
|
||||
email: "test@email.com",
|
||||
email: "test-discount@email.com",
|
||||
payment_status: "captured",
|
||||
fulfillment_status: "fulfilled",
|
||||
discounts: [discount],
|
||||
billing_address: {
|
||||
id: "test-billing-address",
|
||||
id: "test-discount-billing-address",
|
||||
first_name: "lebron",
|
||||
},
|
||||
shipping_address: {
|
||||
@@ -375,12 +374,13 @@ module.exports = async (connection, data = {}) => {
|
||||
tax_rate: 0,
|
||||
payments: [payment],
|
||||
items: [],
|
||||
...data,
|
||||
})
|
||||
|
||||
await manager.save(discountedOrder)
|
||||
|
||||
const dli = manager.create(LineItem, {
|
||||
id: "test-item",
|
||||
id: "test-item-1",
|
||||
fulfilled_quantity: 1,
|
||||
returned_quantity: 0,
|
||||
title: "Line Item",
|
||||
|
||||
Reference in New Issue
Block a user