chore: Merge master to develop (#3653)
This commit is contained in:
committed by
GitHub
parent
b2e2eddcea
commit
809ab2e0eb
@@ -572,11 +572,10 @@ describe("/admin/draft-orders", () => {
|
||||
(item) => item.variant_id === testVariant2Id
|
||||
)
|
||||
|
||||
const lineItem1WeightInTotal = 0.444 // line item amount / amount
|
||||
const lineItem2WeightInTotal = 0.556 // line item amount / amount
|
||||
|
||||
expect(draftOrder.cart.items).toHaveLength(2)
|
||||
|
||||
expect(lineItem1.adjustments).toHaveLength(1)
|
||||
expect(lineItem1.adjustments[0].amount).toBeCloseTo(444, 0) // discountAmount * (line item amount / amount) = 444.4444444444
|
||||
expect(lineItem1).toEqual(
|
||||
expect.objectContaining({
|
||||
variant_id: testVariantId,
|
||||
@@ -585,7 +584,6 @@ describe("/admin/draft-orders", () => {
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
item_id: lineItem1.id,
|
||||
amount: discountAmount * lineItem1WeightInTotal,
|
||||
description: "discount",
|
||||
discount_id: discount.id,
|
||||
}),
|
||||
@@ -593,6 +591,8 @@ describe("/admin/draft-orders", () => {
|
||||
})
|
||||
)
|
||||
|
||||
expect(lineItem2.adjustments).toHaveLength(1)
|
||||
expect(lineItem2.adjustments[0].amount).toBeCloseTo(556, 0) // discountAmount * (line item amount / amount) = 555.5555555555
|
||||
expect(lineItem2).toEqual(
|
||||
expect.objectContaining({
|
||||
variant_id: testVariant2Id,
|
||||
@@ -601,7 +601,6 @@ describe("/admin/draft-orders", () => {
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
item_id: lineItem2.id,
|
||||
amount: discountAmount * lineItem2WeightInTotal,
|
||||
description: "discount",
|
||||
discount_id: discount.id,
|
||||
}),
|
||||
|
||||
@@ -2482,6 +2482,9 @@ describe("/admin/order-edits", () => {
|
||||
)
|
||||
expect(item2.adjustments).toHaveLength(1)
|
||||
|
||||
expect(item1.adjustments[0].amount).toBeCloseTo(1333, 0)
|
||||
expect(item2.adjustments[0].amount).toBeCloseTo(667, 0)
|
||||
|
||||
expect(response.data.order_edit).toEqual(
|
||||
expect.objectContaining({
|
||||
id: orderEditId,
|
||||
@@ -2531,7 +2534,6 @@ describe("/admin/order-edits", () => {
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
discount_id: discount.id,
|
||||
amount: 1333,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
@@ -2564,7 +2566,6 @@ describe("/admin/order-edits", () => {
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
discount_id: discount.id,
|
||||
amount: 667,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
|
||||
@@ -604,13 +604,22 @@ describe("/store/carts", () => {
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items.length).toEqual(2)
|
||||
|
||||
const item1 = response.data.cart.items.find((i) => i.id === "test-li")
|
||||
expect(item1.adjustments).toHaveLength(1)
|
||||
|
||||
const item2 = response.data.cart.items.find((i) => i.id !== "test-li")
|
||||
expect(item2.adjustments).toHaveLength(1)
|
||||
|
||||
expect(item1.adjustments[0].amount).toBeCloseTo(17, 0)
|
||||
expect(item2.adjustments[0].amount).toBeCloseTo(168, 0)
|
||||
|
||||
expect(response.data.cart.items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
item_id: "test-li",
|
||||
amount: 17,
|
||||
discount_id: "medusa-185",
|
||||
}),
|
||||
],
|
||||
@@ -618,7 +627,6 @@ describe("/store/carts", () => {
|
||||
expect.objectContaining({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 168,
|
||||
discount_id: "medusa-185",
|
||||
}),
|
||||
],
|
||||
@@ -663,14 +671,23 @@ describe("/store/carts", () => {
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items.length).toEqual(2)
|
||||
|
||||
const item1 = response.data.cart.items.find((i) => i.id === "test-li")
|
||||
expect(item1.adjustments).toHaveLength(1)
|
||||
|
||||
const item2 = response.data.cart.items.find(
|
||||
(i) => i.id === "line-item-2"
|
||||
)
|
||||
expect(item2.adjustments).toHaveLength(1)
|
||||
|
||||
expect(response.data.cart.items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
item_id: "test-li",
|
||||
amount: 9.25,
|
||||
discount_id: "medusa-185",
|
||||
amount: 9,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
@@ -678,7 +695,7 @@ describe("/store/carts", () => {
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
item_id: "line-item-2",
|
||||
amount: 176,
|
||||
amount: 175.75,
|
||||
discount_id: "medusa-185",
|
||||
}),
|
||||
],
|
||||
|
||||
@@ -168,6 +168,7 @@ describe("/store/carts", () => {
|
||||
// fields
|
||||
"status",
|
||||
"email",
|
||||
|
||||
// relations
|
||||
"shipping_address",
|
||||
"fulfillments",
|
||||
@@ -177,7 +178,8 @@ describe("/store/carts", () => {
|
||||
"customer",
|
||||
"payments",
|
||||
"region",
|
||||
// default
|
||||
|
||||
// totals
|
||||
"shipping_total",
|
||||
"discount_total",
|
||||
"tax_total",
|
||||
@@ -199,6 +201,7 @@ describe("/store/carts", () => {
|
||||
expect(Object.keys(response.data.order)).toEqual([
|
||||
// fields
|
||||
"status",
|
||||
|
||||
// default relations
|
||||
"shipping_address",
|
||||
"fulfillments",
|
||||
@@ -208,7 +211,8 @@ describe("/store/carts", () => {
|
||||
"customer",
|
||||
"payments",
|
||||
"region",
|
||||
// default
|
||||
|
||||
// totals
|
||||
"shipping_total",
|
||||
"discount_total",
|
||||
"tax_total",
|
||||
@@ -232,9 +236,11 @@ describe("/store/carts", () => {
|
||||
expect(Object.keys(response.data.order)).toEqual([
|
||||
// fields
|
||||
"status",
|
||||
|
||||
// selected relations
|
||||
"billing_address",
|
||||
// default
|
||||
|
||||
// totals
|
||||
"shipping_total",
|
||||
"discount_total",
|
||||
"tax_total",
|
||||
|
||||
Reference in New Issue
Block a user