chore(feature-flags): Remove OrderEditing feature flag (#3006)

This commit is contained in:
Oliver Windall Juhl
2023-01-13 12:10:09 +01:00
committed by GitHub
parent d2c692aa96
commit 9e3beaf531
51 changed files with 300 additions and 984 deletions

View File

@@ -3,7 +3,7 @@ const path = require("path")
const startServerWithEnvironment =
require("../../../helpers/start-server-with-environment").default
const { useApi } = require("../../../helpers/use-api")
const { useDb } = require("../../../helpers/use-db")
const { useDb, initDb } = require("../../../helpers/use-db")
const adminSeeder = require("../../helpers/admin-seeder")
const {
simpleOrderEditFactory,
@@ -21,6 +21,7 @@ const {
simpleRegionFactory,
} = require("../../factories")
const { OrderEditItemChangeType, OrderEdit } = require("@medusajs/medusa")
const setupServer = require("../../../helpers/setup-server")
jest.setTimeout(30000)
@@ -30,19 +31,17 @@ const adminHeaders = {
},
}
describe("[MEDUSA_FF_ORDER_EDITING] /admin/order-edits", () => {
describe("/admin/order-edits", () => {
let medusaProcess
let dbConnection
const adminUserId = "admin_user"
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
const [process, connection] = await startServerWithEnvironment({
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
})
dbConnection = connection
medusaProcess = process
})
afterAll(async () => {

View File

@@ -18,7 +18,7 @@ const adminHeaders = {
},
}
describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment-collections", () => {
describe("/admin/payment-collections", () => {
let medusaProcess
let dbConnection
@@ -27,7 +27,6 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment-collections", () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
})
dbConnection = connection
medusaProcess = process

View File

@@ -21,7 +21,7 @@ const adminHeaders = {
},
}
describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment", () => {
describe("/admin/payment", () => {
let medusaProcess
let dbConnection
@@ -30,7 +30,6 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment", () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
})
dbConnection = connection
medusaProcess = process

View File

@@ -1,153 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Claims creates a refund claim 1`] = `
Object {
"additional_items": Array [],
"canceled_at": null,
"claim_items": ArrayContaining [
ObjectContaining {
"item": Any<Object>,
"item_id": "test-item",
"quantity": 1,
},
],
"created_at": Any<String>,
"deleted_at": null,
"fulfillment_status": "not_fulfilled",
"fulfillments": Array [],
"id": StringMatching /\\^claim_\\*/,
"idempotency_key": Any<String>,
"metadata": null,
"no_notification": null,
"order_id": Any<String>,
"payment_status": "refunded",
"refund_amount": 1200,
"return_order": null,
"shipping_address": Any<Object>,
"shipping_address_id": Any<String>,
"shipping_methods": Array [],
"type": "refund",
"updated_at": Any<String>,
}
`;
exports[`Claims creates a replace claim 1`] = `
Object {
"additional_items": Array [
Object {
"adjustments": Array [],
"allow_discounts": true,
"cart_id": null,
"claim_order_id": StringMatching /\\^claim_\\*/,
"created_at": Any<String>,
"description": "Refined Wooden Chair",
"fulfilled_quantity": null,
"has_shipping": null,
"id": StringMatching /\\^item_\\*/,
"is_giftcard": false,
"is_return": false,
"metadata": Object {},
"order_id": null,
"quantity": 1,
"refundable": 113,
"returned_quantity": null,
"shipped_quantity": null,
"should_merge": true,
"swap_id": null,
"tax_lines": Array [
Object {
"code": "default",
"created_at": Any<String>,
"id": StringMatching /\\^litl_\\*/,
"item_id": StringMatching /\\^item_\\*/,
"metadata": null,
"name": "default",
"rate": 12.5,
"updated_at": Any<String>,
},
],
"thumbnail": null,
"title": "Gorgeous Cotton Table",
"unit_price": 100,
"updated_at": Any<String>,
"variant": Object {
"allow_backorder": false,
"barcode": null,
"created_at": Any<String>,
"deleted_at": null,
"ean": null,
"height": null,
"hs_code": null,
"id": "test-variant",
"inventory_quantity": 9,
"length": null,
"manage_inventory": true,
"material": null,
"metadata": null,
"mid_code": null,
"origin_country": null,
"product": Object {
"collection_id": null,
"created_at": Any<String>,
"deleted_at": null,
"description": null,
"discountable": true,
"external_id": null,
"handle": null,
"height": null,
"hs_code": null,
"id": "test-product",
"is_giftcard": false,
"length": null,
"material": null,
"metadata": null,
"mid_code": null,
"origin_country": null,
"profile_id": StringMatching /\\^sp_\\*/,
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<String>,
"weight": null,
"width": null,
},
"product_id": "test-product",
"sku": null,
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<String>,
"weight": null,
"width": null,
},
"variant_id": "test-variant",
},
],
"canceled_at": null,
"claim_items": ArrayContaining [
ObjectContaining {
"item": Any<Object>,
"item_id": "test-item",
"quantity": 1,
},
],
"created_at": Any<String>,
"deleted_at": null,
"fulfillment_status": "not_fulfilled",
"fulfillments": Array [],
"id": StringMatching /\\^claim_\\*/,
"idempotency_key": Any<String>,
"metadata": null,
"no_notification": null,
"order_id": Any<String>,
"payment_status": "na",
"refund_amount": null,
"return_order": null,
"shipping_address": Any<Object>,
"shipping_address_id": Any<String>,
"shipping_methods": Array [],
"type": "replace",
"updated_at": Any<String>,
}
`;

View File

@@ -64,23 +64,20 @@ describe("Claims", () => {
)
expect(response.status).toEqual(200)
expect(response.data.order.claims[0]).toMatchSnapshot({
id: expect.stringMatching(/^claim_*/),
order_id: expect.any(String),
updated_at: expect.any(String),
created_at: expect.any(String),
idempotency_key: expect.any(String),
shipping_address_id: expect.any(String),
refund_amount: 1200,
shipping_address: expect.any(Object),
claim_items: expect.arrayContaining([
expect.objectContaining({
item: expect.any(Object),
item_id: "test-item",
quantity: 1,
}),
]),
})
expect(response.data.order.claims[0]).toEqual(
expect.objectContaining({
id: expect.stringMatching(/^claim_*/),
order_id: expect.any(String),
refund_amount: 1200,
claim_items: expect.arrayContaining([
expect.objectContaining({
item: expect.any(Object),
item_id: "test-item",
quantity: 1,
}),
]),
})
)
})
test("creates a replace claim", async () => {
@@ -110,49 +107,33 @@ describe("Claims", () => {
)
expect(response.status).toEqual(200)
expect(response.data.order.claims[0]).toMatchSnapshot({
id: expect.stringMatching(/^claim_*/),
order_id: expect.any(String),
updated_at: expect.any(String),
created_at: expect.any(String),
idempotency_key: expect.any(String),
shipping_address_id: expect.any(String),
refund_amount: null,
shipping_address: expect.any(Object),
additional_items: [
{
id: expect.stringMatching(/^item_*/),
claim_order_id: expect.stringMatching(/^claim_*/),
created_at: expect.any(String),
updated_at: expect.any(String),
variant: {
created_at: expect.any(String),
updated_at: expect.any(String),
product: {
profile_id: expect.stringMatching(/^sp_*/),
created_at: expect.any(String),
updated_at: expect.any(String),
},
},
tax_lines: [
{
id: expect.stringMatching(/^litl_*/),
item_id: expect.stringMatching(/^item_*/),
created_at: expect.any(String),
updated_at: expect.any(String),
rate: 12.5,
},
],
},
],
claim_items: expect.arrayContaining([
expect.objectContaining({
item: expect.any(Object),
item_id: "test-item",
quantity: 1,
}),
]),
})
expect(response.data.order.claims[0]).toEqual(
expect.objectContaining({
id: expect.stringMatching(/^claim_*/),
order_id: expect.any(String),
additional_items: expect.arrayContaining([
expect.objectContaining({
id: expect.stringMatching(/^item_*/),
claim_order_id: expect.stringMatching(/^claim_*/),
variant: expect.objectContaining({ id: "test-variant" }),
tax_lines: expect.arrayContaining([
expect.objectContaining({
id: expect.stringMatching(/^litl_*/),
item_id: expect.stringMatching(/^item_*/),
rate: 12.5,
}),
]),
}),
]),
claim_items: expect.arrayContaining([
expect.objectContaining({
item: expect.any(Object),
item_id: "test-item",
quantity: 1,
}),
]),
})
)
})
test("creates a replace claim fulfillment", async () => {

View File

@@ -1,385 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`/store/carts /store/swaps simple swap 1`] = `
Object {
"swap": Object {
"additional_items": Array [
Object {
"allow_discounts": true,
"cart_id": StringMatching /\\^cart_\\*/,
"claim_order_id": null,
"created_at": Any<String>,
"description": "Swap product",
"fulfilled_quantity": null,
"has_shipping": null,
"id": StringMatching /\\^item_\\*/,
"is_giftcard": false,
"is_return": false,
"metadata": Object {},
"order_id": null,
"quantity": 1,
"returned_quantity": null,
"shipped_quantity": null,
"should_merge": true,
"swap_id": StringMatching /\\^swap_\\*/,
"thumbnail": null,
"title": "test product",
"unit_price": 8000,
"updated_at": Any<String>,
"variant": Object {
"allow_backorder": false,
"barcode": null,
"created_at": Any<String>,
"deleted_at": null,
"ean": null,
"height": null,
"hs_code": null,
"id": "test-variant-2",
"inventory_quantity": 1,
"length": null,
"manage_inventory": true,
"material": null,
"metadata": null,
"mid_code": null,
"origin_country": null,
"product": Object {
"collection_id": null,
"created_at": Any<String>,
"deleted_at": null,
"description": null,
"discountable": true,
"external_id": null,
"handle": null,
"height": null,
"hs_code": null,
"id": "test-product",
"is_giftcard": false,
"length": null,
"material": null,
"metadata": null,
"mid_code": null,
"origin_country": null,
"profile_id": StringMatching /\\^sp_\\*/,
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "test product",
"type_id": null,
"updated_at": Any<String>,
"weight": null,
"width": null,
},
"product_id": "test-product",
"sku": null,
"title": "Swap product",
"upc": null,
"updated_at": Any<String>,
"weight": null,
"width": null,
},
"variant_id": "test-variant-2",
},
],
"cart": Object {
"billing_address_id": "test-billing-address",
"completed_at": null,
"context": Object {},
"created_at": Any<String>,
"customer_id": "test-customer",
"deleted_at": null,
"email": "test@email.com",
"id": StringMatching /\\^cart_\\*/,
"idempotency_key": null,
"metadata": Object {
"parent_order_id": "test-order",
"swap_id": StringMatching /\\^swap_\\*/,
},
"object": "cart",
"payment_authorized_at": null,
"payment_id": null,
"region_id": "test-region",
"sales_channel_id": Any<String>,
"shipping_address_id": "test-shipping-address",
"type": "swap",
"updated_at": Any<String>,
},
"cart_id": StringMatching /\\^cart_\\*/,
"confirmed_at": null,
"created_at": Any<String>,
"deleted_at": null,
"difference_due": null,
"fulfillment_status": "not_fulfilled",
"fulfillments": Array [],
"id": StringMatching /\\^swap_\\*/,
"idempotency_key": Any<String>,
"metadata": null,
"order": Object {
"billing_address_id": "test-billing-address",
"canceled_at": null,
"cart_id": null,
"created_at": Any<String>,
"currency_code": "usd",
"customer_id": "test-customer",
"display_id": 1,
"draft_order_id": null,
"email": "test@email.com",
"external_id": null,
"fulfillment_status": "fulfilled",
"id": "test-order",
"idempotency_key": null,
"metadata": null,
"no_notification": null,
"object": "order",
"payment_status": "captured",
"region_id": "test-region",
"sales_channel_id": null,
"shipping_address_id": "test-shipping-address",
"status": "pending",
"tax_rate": 0,
"updated_at": Any<String>,
},
"order_id": "test-order",
"payment": null,
"payment_status": "not_paid",
"return_order": Object {
"claim_order_id": null,
"created_at": Any<String>,
"id": StringMatching /\\^ret_\\*/,
"idempotency_key": null,
"items": Array [
Object {
"is_requested": true,
"item_id": "test-item",
"metadata": null,
"note": null,
"quantity": 1,
"reason_id": null,
"received_quantity": null,
"requested_quantity": 1,
"return_id": StringMatching /\\^ret_\\*/,
},
],
"location_id": null,
"metadata": null,
"no_notification": true,
"order_id": null,
"received_at": null,
"refund_amount": 7200,
"shipping_data": null,
"shipping_method": null,
"status": "requested",
"swap_id": StringMatching /\\^swap_\\*/,
"updated_at": Any<String>,
},
"shipping_address": null,
"shipping_address_id": null,
"shipping_methods": Array [],
"updated_at": Any<String>,
},
}
`;
exports[`/store/carts /store/swaps swap with return shipping 1`] = `
Object {
"swap": Object {
"additional_items": Array [
Object {
"allow_discounts": true,
"cart_id": StringMatching /\\^cart_\\*/,
"claim_order_id": null,
"created_at": Any<String>,
"description": "Swap product",
"fulfilled_quantity": null,
"has_shipping": null,
"id": StringMatching /\\^item_\\*/,
"is_giftcard": false,
"is_return": false,
"metadata": Object {},
"order_id": null,
"quantity": 1,
"returned_quantity": null,
"shipped_quantity": null,
"should_merge": true,
"swap_id": StringMatching /\\^swap_\\*/,
"thumbnail": null,
"title": "test product",
"unit_price": 8000,
"updated_at": Any<String>,
"variant": Object {
"allow_backorder": false,
"barcode": null,
"created_at": Any<String>,
"deleted_at": null,
"ean": null,
"height": null,
"hs_code": null,
"id": "test-variant-2",
"inventory_quantity": 1,
"length": null,
"manage_inventory": true,
"material": null,
"metadata": null,
"mid_code": null,
"origin_country": null,
"product": Object {
"collection_id": null,
"created_at": Any<String>,
"deleted_at": null,
"description": null,
"discountable": true,
"external_id": null,
"handle": null,
"height": null,
"hs_code": null,
"id": "test-product",
"is_giftcard": false,
"length": null,
"material": null,
"metadata": null,
"mid_code": null,
"origin_country": null,
"profile_id": StringMatching /\\^sp_\\*/,
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "test product",
"type_id": null,
"updated_at": Any<String>,
"weight": null,
"width": null,
},
"product_id": "test-product",
"sku": null,
"title": "Swap product",
"upc": null,
"updated_at": Any<String>,
"weight": null,
"width": null,
},
"variant_id": "test-variant-2",
},
],
"cart": Object {
"billing_address_id": "test-billing-address",
"completed_at": null,
"context": Object {},
"created_at": Any<String>,
"customer_id": "test-customer",
"deleted_at": null,
"email": "test@email.com",
"id": StringMatching /\\^cart_\\*/,
"idempotency_key": null,
"metadata": Object {
"parent_order_id": "test-order",
"swap_id": StringMatching /\\^swap_\\*/,
},
"object": "cart",
"payment_authorized_at": null,
"payment_id": null,
"region_id": "test-region",
"sales_channel_id": Any<String>,
"shipping_address_id": "test-shipping-address",
"type": "swap",
"updated_at": Any<String>,
},
"cart_id": StringMatching /\\^cart_\\*/,
"confirmed_at": null,
"created_at": Any<String>,
"deleted_at": null,
"difference_due": null,
"fulfillment_status": "not_fulfilled",
"fulfillments": Array [],
"id": StringMatching /\\^swap_\\*/,
"idempotency_key": Any<String>,
"metadata": null,
"order": Object {
"billing_address_id": "test-billing-address",
"canceled_at": null,
"cart_id": null,
"created_at": Any<String>,
"currency_code": "usd",
"customer_id": "test-customer",
"display_id": Any<Number>,
"draft_order_id": null,
"email": "test@email.com",
"external_id": null,
"fulfillment_status": "fulfilled",
"id": "test-order",
"idempotency_key": null,
"metadata": null,
"no_notification": null,
"object": "order",
"payment_status": "captured",
"region_id": "test-region",
"sales_channel_id": null,
"shipping_address_id": "test-shipping-address",
"status": "pending",
"tax_rate": 0,
"updated_at": Any<String>,
},
"order_id": "test-order",
"payment": null,
"payment_status": "not_paid",
"return_order": Object {
"claim_order_id": null,
"created_at": Any<String>,
"id": StringMatching /\\^ret_\\*/,
"idempotency_key": null,
"items": Array [
Object {
"is_requested": true,
"item_id": "test-item",
"metadata": null,
"note": null,
"quantity": 1,
"reason_id": null,
"received_quantity": null,
"requested_quantity": 1,
"return_id": StringMatching /\\^ret_\\*/,
},
],
"location_id": null,
"metadata": null,
"no_notification": true,
"order_id": null,
"received_at": null,
"refund_amount": 6200,
"shipping_data": Object {},
"shipping_method": Object {
"cart_id": null,
"claim_order_id": null,
"data": Object {},
"id": StringMatching /\\^sm_\\*/,
"order_id": null,
"price": 1000,
"return_id": StringMatching /\\^ret_\\*/,
"shipping_option": Object {
"admin_only": false,
"amount": 1000,
"created_at": Any<String>,
"data": Object {},
"deleted_at": null,
"id": "return-option",
"is_return": true,
"metadata": null,
"name": "Test ret",
"price_type": "flat_rate",
"profile_id": StringMatching /\\^sp_\\*/,
"provider_id": "test-ful",
"region_id": "test-region",
"updated_at": Any<String>,
},
"shipping_option_id": "return-option",
"swap_id": null,
},
"status": "requested",
"swap_id": StringMatching /\\^swap_\\*/,
"updated_at": Any<String>,
},
"shipping_address": null,
"shipping_address_id": null,
"shipping_methods": Array [],
"updated_at": Any<String>,
},
}
`;

View File

@@ -3,7 +3,7 @@ const path = require("path")
const startServerWithEnvironment =
require("../../../helpers/start-server-with-environment").default
const { useApi } = require("../../../helpers/use-api")
const { useDb } = require("../../../helpers/use-db")
const { useDb, initDb } = require("../../../helpers/use-db")
const adminSeeder = require("../../helpers/admin-seeder")
const {
getClientAuthenticationCookie,
@@ -22,21 +22,20 @@ const {
simpleCustomerFactory,
} = require("../../factories")
const { OrderEditItemChangeType } = require("@medusajs/medusa")
const setupServer = require("../../../helpers/setup-server")
jest.setTimeout(30000)
describe("[MEDUSA_FF_ORDER_EDITING] /store/order-edits", () => {
describe("/store/order-edits", () => {
let medusaProcess
let dbConnection
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
const [process, connection] = await startServerWithEnvironment({
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
})
dbConnection = connection
medusaProcess = process
await simpleCustomerFactory(dbConnection, {
id: "customer",

View File

@@ -18,7 +18,7 @@ const {
jest.setTimeout(30000)
describe("[MEDUSA_FF_ORDER_EDITING] /store/payment-collections", () => {
describe("/store/payment-collections", () => {
let medusaProcess
let dbConnection
@@ -27,7 +27,6 @@ describe("[MEDUSA_FF_ORDER_EDITING] /store/payment-collections", () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
})
dbConnection = connection
medusaProcess = process

View File

@@ -81,67 +81,50 @@ describe("/store/carts", () => {
console.log(err.response.data.message)
})
expect(response.data).toMatchSnapshot({
swap: {
id: expect.stringMatching(/^swap_*/),
idempotency_key: expect.any(String),
additional_items: [
{
id: expect.stringMatching(/^item_*/),
cart_id: expect.stringMatching(/^cart_*/),
swap_id: expect.stringMatching(/^swap_*/),
variant: {
id: "test-variant-2",
created_at: expect.any(String),
updated_at: expect.any(String),
product: {
profile_id: expect.stringMatching(/^sp_*/),
created_at: expect.any(String),
updated_at: expect.any(String),
},
},
quantity: 1,
variant_id: "test-variant-2",
created_at: expect.any(String),
updated_at: expect.any(String),
},
],
order: {
id: "test-order",
created_at: expect.any(String),
updated_at: expect.any(String),
},
cart_id: expect.stringMatching(/^cart_*/),
cart: {
id: expect.stringMatching(/^cart_*/),
sales_channel_id: expect.any(String),
billing_address_id: "test-billing-address",
type: "swap",
created_at: expect.any(String),
updated_at: expect.any(String),
shipping_address_id: "test-shipping-address",
metadata: {
swap_id: expect.stringMatching(/^swap_*/),
},
},
return_order: {
id: expect.stringMatching(/^ret_*/),
swap_id: expect.stringMatching(/^swap_*/),
refund_amount: 7200,
items: [
{
item_id: "test-item",
expect(response.data).toEqual(
expect.objectContaining({
swap: expect.objectContaining({
id: expect.stringMatching(/^swap_*/),
additional_items: expect.arrayContaining([
expect.objectContaining({
id: expect.stringMatching(/^item_*/),
cart_id: expect.stringMatching(/^cart_*/),
swap_id: expect.stringMatching(/^swap_*/),
variant: expect.objectContaining({
id: "test-variant-2",
}),
quantity: 1,
return_id: expect.stringMatching(/^ret_*/),
},
],
created_at: expect.any(String),
updated_at: expect.any(String),
},
created_at: expect.any(String),
updated_at: expect.any(String),
},
})
variant_id: "test-variant-2",
}),
]),
order: expect.objectContaining({
id: "test-order",
}),
cart_id: expect.stringMatching(/^cart_*/),
cart: expect.objectContaining({
id: expect.stringMatching(/^cart_*/),
billing_address_id: "test-billing-address",
type: "swap",
shipping_address_id: "test-shipping-address",
metadata: expect.objectContaining({
swap_id: expect.stringMatching(/^swap_*/),
}),
}),
return_order: expect.objectContaining({
id: expect.stringMatching(/^ret_*/),
swap_id: expect.stringMatching(/^swap_*/),
refund_amount: 7200,
items: expect.arrayContaining([
expect.objectContaining({
item_id: "test-item",
quantity: 1,
return_id: expect.stringMatching(/^ret_*/),
}),
]),
}),
}),
})
)
})
it("swap with return shipping", async () => {
@@ -168,76 +151,54 @@ describe("/store/carts", () => {
console.log(err.response.data.message)
})
expect(response.data).toMatchSnapshot({
swap: {
expect(response.data).toEqual({
swap: expect.objectContaining({
id: expect.stringMatching(/^swap_*/),
idempotency_key: expect.any(String),
additional_items: [
{
additional_items: expect.arrayContaining([
expect.objectContaining({
id: expect.stringMatching(/^item_*/),
cart_id: expect.stringMatching(/^cart_*/),
swap_id: expect.stringMatching(/^swap_*/),
variant: {
variant: expect.objectContaining({
id: "test-variant-2",
created_at: expect.any(String),
updated_at: expect.any(String),
product: {
profile_id: expect.stringMatching(/^sp_*/),
created_at: expect.any(String),
updated_at: expect.any(String),
},
},
}),
quantity: 1,
variant_id: "test-variant-2",
created_at: expect.any(String),
updated_at: expect.any(String),
},
],
order: {
}),
]),
order: expect.objectContaining({
id: "test-order",
display_id: expect.any(Number),
created_at: expect.any(String),
updated_at: expect.any(String),
},
}),
cart_id: expect.stringMatching(/^cart_*/),
cart: {
cart: expect.objectContaining({
id: expect.stringMatching(/^cart_*/),
sales_channel_id: expect.any(String),
billing_address_id: "test-billing-address",
shipping_address_id: "test-shipping-address",
type: "swap",
created_at: expect.any(String),
updated_at: expect.any(String),
metadata: {
metadata: expect.objectContaining({
swap_id: expect.stringMatching(/^swap_*/),
},
},
return_order: {
}),
}),
return_order: expect.objectContaining({
id: expect.stringMatching(/^ret_*/),
swap_id: expect.stringMatching(/^swap_*/),
refund_amount: 6200,
shipping_method: {
shipping_method: expect.objectContaining({
id: expect.stringMatching(/^sm_*/),
return_id: expect.stringMatching(/^ret_*/),
shipping_option: {
shipping_option: expect.objectContaining({
profile_id: expect.stringMatching(/^sp_*/),
created_at: expect.any(String),
updated_at: expect.any(String),
},
},
items: [
{
}),
}),
items: expect.arrayContaining([
expect.objectContaining({
item_id: "test-item",
quantity: 1,
return_id: expect.stringMatching(/^ret_*/),
},
],
created_at: expect.any(String),
updated_at: expect.any(String),
},
created_at: expect.any(String),
updated_at: expect.any(String),
},
}),
]),
}),
}),
})
})
})