@ehrenkind/shopify-lib 0.0.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -34
- package/dist/generated-api-types/2025-04/admin.generated.d.ts +283 -0
- package/dist/generated-api-types/2025-04/admin.generated.d.ts.map +1 -0
- package/dist/generated-api-types/2025-04/admin.generated.js +5 -0
- package/dist/generated-api-types/2025-04/admin.generated.js.map +1 -0
- package/dist/generated-api-types/2025-04/admin.types.d.ts +60044 -0
- package/dist/generated-api-types/2025-04/admin.types.d.ts.map +1 -0
- package/dist/generated-api-types/2025-04/admin.types.js +11451 -0
- package/dist/generated-api-types/2025-04/admin.types.js.map +1 -0
- package/dist/index.cjs +370 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +328 -58
- package/dist/index.d.ts +6 -18874
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +368 -41
- package/dist/index.mjs.map +1 -1
- package/dist/mutations/customers/deleteCustomerById.d.ts +4 -0
- package/dist/mutations/customers/deleteCustomerById.d.ts.map +1 -0
- package/dist/mutations/customers/deleteCustomerById.js +38 -0
- package/dist/mutations/customers/deleteCustomerById.js.map +1 -0
- package/dist/mutations/customers/deleteCustomerById.mock.d.ts +4 -0
- package/dist/mutations/customers/deleteCustomerById.mock.d.ts.map +1 -0
- package/dist/mutations/customers/deleteCustomerById.mock.js +8 -0
- package/dist/mutations/customers/deleteCustomerById.mock.js.map +1 -0
- package/dist/mutations/customers/deleteCustomerById.test.d.ts +2 -0
- package/dist/mutations/customers/deleteCustomerById.test.d.ts.map +1 -0
- package/dist/mutations/customers/deleteCustomerById.test.js +10 -0
- package/dist/mutations/customers/deleteCustomerById.test.js.map +1 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.d.ts +4 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.d.ts.map +1 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.js +56 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.js.map +1 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.mock.d.ts +3 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.mock.d.ts.map +1 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.mock.js +11 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.mock.js.map +1 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.test.d.ts +2 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.test.d.ts.map +1 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.test.js +11 -0
- package/dist/mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.test.js.map +1 -0
- package/dist/queries/orders/getOrderById.d.ts +136 -0
- package/dist/queries/orders/getOrderById.d.ts.map +1 -0
- package/dist/queries/orders/getOrderById.js +125 -0
- package/dist/queries/orders/getOrderById.js.map +1 -0
- package/dist/queries/orders/getOrderById.mock.d.ts +82 -0
- package/dist/queries/orders/getOrderById.mock.d.ts.map +1 -0
- package/dist/queries/orders/getOrderById.mock.js +204 -0
- package/dist/queries/orders/getOrderById.mock.js.map +1 -0
- package/dist/queries/orders/getOrderById.queries.d.ts +3 -0
- package/dist/queries/orders/getOrderById.queries.d.ts.map +1 -0
- package/dist/queries/orders/getOrderById.queries.js +174 -0
- package/dist/queries/orders/getOrderById.queries.js.map +1 -0
- package/dist/queries/orders/getOrderById.test.d.ts +2 -0
- package/dist/queries/orders/getOrderById.test.d.ts.map +1 -0
- package/dist/queries/orders/getOrderById.test.js +46 -0
- package/dist/queries/orders/getOrderById.test.js.map +1 -0
- package/dist/queries/orders/getOrderByName.d.ts +72 -0
- package/dist/queries/orders/getOrderByName.d.ts.map +1 -0
- package/dist/queries/orders/getOrderByName.js +117 -0
- package/dist/queries/orders/getOrderByName.js.map +1 -0
- package/dist/queries/orders/getOrderByName.mock.d.ts +21 -0
- package/dist/queries/orders/getOrderByName.mock.d.ts.map +1 -0
- package/dist/queries/orders/getOrderByName.mock.js +55 -0
- package/dist/queries/orders/getOrderByName.mock.js.map +1 -0
- package/dist/queries/orders/getOrderByName.queries.d.ts +3 -0
- package/dist/queries/orders/getOrderByName.queries.d.ts.map +1 -0
- package/dist/queries/orders/getOrderByName.queries.js +335 -0
- package/dist/queries/orders/getOrderByName.queries.js.map +1 -0
- package/dist/queries/orders/getOrderByName.test.d.ts +2 -0
- package/dist/queries/orders/getOrderByName.test.d.ts.map +1 -0
- package/dist/queries/orders/getOrderByName.test.js +30 -0
- package/dist/queries/orders/getOrderByName.test.js.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.d.ts +130 -0
- package/dist/queries/orders/getOrderPaymentDetails.d.ts.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.js +45 -0
- package/dist/queries/orders/getOrderPaymentDetails.js.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.mock.d.ts +12 -0
- package/dist/queries/orders/getOrderPaymentDetails.mock.d.ts.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.mock.js +24 -0
- package/dist/queries/orders/getOrderPaymentDetails.mock.js.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.queries.d.ts +2 -0
- package/dist/queries/orders/getOrderPaymentDetails.queries.d.ts.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.queries.js +21 -0
- package/dist/queries/orders/getOrderPaymentDetails.queries.js.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.test.d.ts +2 -0
- package/dist/queries/orders/getOrderPaymentDetails.test.d.ts.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.test.js +19 -0
- package/dist/queries/orders/getOrderPaymentDetails.test.js.map +1 -0
- package/dist/queries/productVariants/getLeanProductVariants.d.ts +33 -0
- package/dist/queries/productVariants/getLeanProductVariants.d.ts.map +1 -0
- package/dist/queries/productVariants/getLeanProductVariants.js +81 -0
- package/dist/queries/productVariants/getLeanProductVariants.js.map +1 -0
- package/dist/queries/productVariants/getLeanProductVariants.mock.d.ts +3 -0
- package/dist/queries/productVariants/getLeanProductVariants.mock.d.ts.map +1 -0
- package/dist/queries/productVariants/getLeanProductVariants.mock.js +33 -0
- package/dist/queries/productVariants/getLeanProductVariants.mock.js.map +1 -0
- package/dist/queries/productVariants/getLeanProductVariants.test.d.ts +2 -0
- package/dist/queries/productVariants/getLeanProductVariants.test.d.ts.map +1 -0
- package/dist/queries/productVariants/getLeanProductVariants.test.js +38 -0
- package/dist/queries/productVariants/getLeanProductVariants.test.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +50 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mswHandlers.d.ts +2 -0
- package/dist/utils/mswHandlers.d.ts.map +1 -0
- package/dist/utils/mswHandlers.js +46 -0
- package/dist/utils/mswHandlers.js.map +1 -0
- package/dist/utils/shopifyClient.d.ts +6 -0
- package/dist/utils/shopifyClient.d.ts.map +1 -0
- package/dist/utils/shopifyClient.js +82 -0
- package/dist/utils/shopifyClient.js.map +1 -0
- package/dist/utils/shopifyClient.mock.d.ts +3 -0
- package/dist/utils/shopifyClient.mock.d.ts.map +1 -0
- package/dist/utils/shopifyClient.mock.js +19 -0
- package/dist/utils/shopifyClient.mock.js.map +1 -0
- package/dist/utils/shopifyClient.test.d.ts +2 -0
- package/dist/utils/shopifyClient.test.d.ts.map +1 -0
- package/dist/utils/shopifyClient.test.js +27 -0
- package/dist/utils/shopifyClient.test.js.map +1 -0
- package/dist/utils/shopifyFetch.d.ts +24 -0
- package/dist/utils/shopifyFetch.d.ts.map +1 -0
- package/dist/utils/shopifyFetch.js +67 -0
- package/dist/utils/shopifyFetch.js.map +1 -0
- package/dist/utils/shopifyFetch.test.d.ts +2 -0
- package/dist/utils/shopifyFetch.test.d.ts.map +1 -0
- package/dist/utils/shopifyFetch.test.js +17 -0
- package/dist/utils/shopifyFetch.test.js.map +1 -0
- package/dist/utils/test-setup.d.ts +2 -0
- package/dist/utils/test-setup.d.ts.map +1 -0
- package/dist/utils/test-setup.js +13 -0
- package/dist/utils/test-setup.js.map +1 -0
- package/dist/utils/zod.d.ts +3 -0
- package/dist/utils/zod.d.ts.map +1 -0
- package/dist/utils/zod.js +19 -0
- package/dist/utils/zod.js.map +1 -0
- package/package.json +8 -5
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { logger } from '../../utils/logger.js';
|
|
3
|
+
import { convertIdIntoGid, fetchShopifyGraphql, } from '../../utils/shopifyFetch.js';
|
|
4
|
+
import { returnOutputParsed } from '../../utils/zod.js';
|
|
5
|
+
import { queryOrderById, queryOrderByIdFull } from './getOrderById.queries.js';
|
|
6
|
+
// Address schema (shared between lean and full)
|
|
7
|
+
const AddressSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
firstName: z.string().nullable(),
|
|
10
|
+
lastName: z.string().nullable(),
|
|
11
|
+
address1: z.string().nullable(),
|
|
12
|
+
address2: z.string().nullable(),
|
|
13
|
+
city: z.string().nullable(),
|
|
14
|
+
province: z.string().nullable(),
|
|
15
|
+
country: z.string().nullable(),
|
|
16
|
+
zip: z.string().nullable(),
|
|
17
|
+
})
|
|
18
|
+
.nullable();
|
|
19
|
+
// Lean order schema
|
|
20
|
+
const GetLeanOrderByIdReturn = z
|
|
21
|
+
.object({
|
|
22
|
+
id: z.string(),
|
|
23
|
+
name: z.string(),
|
|
24
|
+
createdAt: z.string(),
|
|
25
|
+
updatedAt: z.string(),
|
|
26
|
+
cancelledAt: z.string().nullable(),
|
|
27
|
+
cancelReason: z.string().nullable(),
|
|
28
|
+
totalPrice: z.object({
|
|
29
|
+
amount: z.string(),
|
|
30
|
+
currencyCode: z.string(),
|
|
31
|
+
}),
|
|
32
|
+
customer: z
|
|
33
|
+
.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
displayName: z.string(),
|
|
36
|
+
firstName: z.string().nullable(),
|
|
37
|
+
lastName: z.string().nullable(),
|
|
38
|
+
emailAddress: z.string().nullable(),
|
|
39
|
+
})
|
|
40
|
+
.nullable(),
|
|
41
|
+
financialStatus: z.string().nullable(),
|
|
42
|
+
fulfillmentStatus: z.string().nullable(),
|
|
43
|
+
shippingAddress: AddressSchema,
|
|
44
|
+
})
|
|
45
|
+
.nullable();
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves a single order from Shopify by its numeric ID.
|
|
48
|
+
* Returns null if no order is found with the specified ID.
|
|
49
|
+
*
|
|
50
|
+
* @param {bigint} id - The numerical Shopify order ID (e.g., 12345678n).
|
|
51
|
+
* @param {OrderDetailLevel} detailLevel - The level of detail to return ('lean' or 'full'). Defaults to 'lean'.
|
|
52
|
+
* @returns {Promise<LeanOrder | FullOrder>} A promise that resolves to the order data or null if not found.
|
|
53
|
+
* @throws {Error} If the GraphQL query fails or if the response structure is invalid.
|
|
54
|
+
*/
|
|
55
|
+
export async function getOrderById(id, detailLevel = 'lean') {
|
|
56
|
+
if (detailLevel === 'lean') {
|
|
57
|
+
return getLeanOrderById(id);
|
|
58
|
+
}
|
|
59
|
+
return getFullOrderById(id);
|
|
60
|
+
}
|
|
61
|
+
async function getLeanOrderById(id) {
|
|
62
|
+
const variables = {
|
|
63
|
+
id: convertIdIntoGid(id, 'Order'),
|
|
64
|
+
};
|
|
65
|
+
const response = await fetchShopifyGraphql({
|
|
66
|
+
query: queryOrderById,
|
|
67
|
+
variables,
|
|
68
|
+
});
|
|
69
|
+
if (!response.order) {
|
|
70
|
+
logger.debug(`No order found with ID: ${id}`);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const order = response.order;
|
|
74
|
+
const leanOrder = {
|
|
75
|
+
id: order.id,
|
|
76
|
+
name: order.name,
|
|
77
|
+
createdAt: order.createdAt,
|
|
78
|
+
updatedAt: order.updatedAt,
|
|
79
|
+
cancelledAt: order.cancelledAt ?? null,
|
|
80
|
+
cancelReason: order.cancelReason ?? null,
|
|
81
|
+
totalPrice: {
|
|
82
|
+
amount: order.totalPriceSet?.shopMoney?.amount ?? '',
|
|
83
|
+
currencyCode: order.totalPriceSet?.shopMoney?.currencyCode ?? '',
|
|
84
|
+
},
|
|
85
|
+
customer: order.customer
|
|
86
|
+
? {
|
|
87
|
+
id: order.customer.id,
|
|
88
|
+
displayName: order.customer.displayName,
|
|
89
|
+
firstName: order.customer.firstName ?? null,
|
|
90
|
+
lastName: order.customer.lastName ?? null,
|
|
91
|
+
emailAddress: order.customer.defaultEmailAddress?.emailAddress ?? null,
|
|
92
|
+
}
|
|
93
|
+
: null,
|
|
94
|
+
financialStatus: order.displayFinancialStatus ?? null,
|
|
95
|
+
fulfillmentStatus: order.displayFulfillmentStatus ?? null,
|
|
96
|
+
shippingAddress: order.shippingAddress
|
|
97
|
+
? {
|
|
98
|
+
firstName: order.shippingAddress.firstName ?? null,
|
|
99
|
+
lastName: order.shippingAddress.lastName ?? null,
|
|
100
|
+
address1: order.shippingAddress.address1 ?? null,
|
|
101
|
+
address2: order.shippingAddress.address2 ?? null,
|
|
102
|
+
city: order.shippingAddress.city ?? null,
|
|
103
|
+
province: order.shippingAddress.province ?? null,
|
|
104
|
+
country: order.shippingAddress.country ?? null,
|
|
105
|
+
zip: order.shippingAddress.zip ?? null,
|
|
106
|
+
}
|
|
107
|
+
: null,
|
|
108
|
+
};
|
|
109
|
+
return await returnOutputParsed(leanOrder, GetLeanOrderByIdReturn);
|
|
110
|
+
}
|
|
111
|
+
async function getFullOrderById(id) {
|
|
112
|
+
const variables = {
|
|
113
|
+
id: convertIdIntoGid(id, 'Order'),
|
|
114
|
+
};
|
|
115
|
+
const response = await fetchShopifyGraphql({
|
|
116
|
+
query: queryOrderByIdFull,
|
|
117
|
+
variables,
|
|
118
|
+
});
|
|
119
|
+
if (!response.order) {
|
|
120
|
+
logger.debug(`No order found with ID: ${id}`);
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
return response.order;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=getOrderById.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrderById.js","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAMnB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9E,gDAAgD;AAChD,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3B,CAAC;KACD,QAAQ,EAAE,CAAA;AAEb,oBAAoB;AACpB,MAAM,sBAAsB,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,EAAE,EAAE,C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IdQuery } from '../../generated-api-types/2025-04/admin.generated';
|
|
2
|
+
export declare const orderByIdMock: OrderByIdQuery;
|
|
3
|
+
export declare const expectedLeanOrderById: {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
cancelledAt: null;
|
|
9
|
+
cancelReason: null;
|
|
10
|
+
totalPrice: {
|
|
11
|
+
amount: string;
|
|
12
|
+
currencyCode: string;
|
|
13
|
+
};
|
|
14
|
+
customer: {
|
|
15
|
+
id: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
firstName: string;
|
|
18
|
+
lastName: string;
|
|
19
|
+
emailAddress: string;
|
|
20
|
+
};
|
|
21
|
+
financialStatus: string;
|
|
22
|
+
fulfillmentStatus: string;
|
|
23
|
+
shippingAddress: {
|
|
24
|
+
firstName: string;
|
|
25
|
+
lastName: string;
|
|
26
|
+
address1: string;
|
|
27
|
+
address2: string;
|
|
28
|
+
city: string;
|
|
29
|
+
province: string;
|
|
30
|
+
country: string;
|
|
31
|
+
zip: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare const orderByIdFullMock: OrderByIdFullQuery;
|
|
35
|
+
export declare const expectedFullOrderById: import("../../generated-api-types/2025-04/admin.types").Maybe<Pick<import("../../generated-api-types/2025-04/admin.types").Order, "id" | "createdAt" | "updatedAt" | "name" | "cancelledAt" | "cancelReason" | "displayFinancialStatus" | "displayFulfillmentStatus" | "closedAt" | "discountCodes" | "processedAt"> & {
|
|
36
|
+
totalPriceSet: {
|
|
37
|
+
shopMoney: Pick<import("../../generated-api-types/2025-04/admin.types").MoneyV2, "amount" | "currencyCode">;
|
|
38
|
+
};
|
|
39
|
+
customer?: import("../../generated-api-types/2025-04/admin.types").Maybe<Pick<import("../../generated-api-types/2025-04/admin.types").Customer, "id" | "firstName" | "lastName" | "email" | "phone">>;
|
|
40
|
+
shippingAddress?: import("../../generated-api-types/2025-04/admin.types").Maybe<Pick<import("../../generated-api-types/2025-04/admin.types").MailingAddress, "firstName" | "lastName" | "address1" | "address2" | "city" | "province" | "country" | "zip">>;
|
|
41
|
+
billingAddress?: import("../../generated-api-types/2025-04/admin.types").Maybe<Pick<import("../../generated-api-types/2025-04/admin.types").MailingAddress, "firstName" | "lastName" | "address1" | "address2" | "city" | "province" | "country" | "zip">>;
|
|
42
|
+
lineItems: {
|
|
43
|
+
edges: Array<{
|
|
44
|
+
node: (Pick<import("../../generated-api-types/2025-04/admin.types").LineItem, "id" | "sku" | "title" | "variantTitle" | "quantity" | "vendor"> & {
|
|
45
|
+
customAttributes: Array<Pick<import("../../generated-api-types/2025-04/admin.types").Attribute, "key" | "value">>;
|
|
46
|
+
originalUnitPriceSet: {
|
|
47
|
+
shopMoney: Pick<import("../../generated-api-types/2025-04/admin.types").MoneyV2, "amount" | "currencyCode">;
|
|
48
|
+
};
|
|
49
|
+
image?: import("../../generated-api-types/2025-04/admin.types").Maybe<Pick<import("../../generated-api-types/2025-04/admin.types").Image, "url" | "width" | "height" | "altText">>;
|
|
50
|
+
});
|
|
51
|
+
}>;
|
|
52
|
+
};
|
|
53
|
+
fulfillments: Array<(Pick<import("../../generated-api-types/2025-04/admin.types").Fulfillment, "id" | "name" | "totalQuantity" | "status" | "createdAt" | "estimatedDeliveryAt" | "deliveredAt"> & {
|
|
54
|
+
trackingInfo: Array<Pick<import("../../generated-api-types/2025-04/admin.types").FulfillmentTrackingInfo, "company" | "number" | "url">>;
|
|
55
|
+
fulfillmentLineItems: {
|
|
56
|
+
edges: Array<{
|
|
57
|
+
node: (Pick<import("../../generated-api-types/2025-04/admin.types").FulfillmentLineItem, "id" | "quantity"> & {
|
|
58
|
+
lineItem: Pick<import("../../generated-api-types/2025-04/admin.types").LineItem, "id">;
|
|
59
|
+
});
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
})>;
|
|
63
|
+
shippingLine?: import("../../generated-api-types/2025-04/admin.types").Maybe<{
|
|
64
|
+
originalPriceSet: {
|
|
65
|
+
shopMoney: Pick<import("../../generated-api-types/2025-04/admin.types").MoneyV2, "amount" | "currencyCode">;
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
taxLines: Array<{
|
|
69
|
+
priceSet: {
|
|
70
|
+
shopMoney: Pick<import("../../generated-api-types/2025-04/admin.types").MoneyV2, "amount" | "currencyCode">;
|
|
71
|
+
};
|
|
72
|
+
}>;
|
|
73
|
+
totalDiscountsSet?: import("../../generated-api-types/2025-04/admin.types").Maybe<{
|
|
74
|
+
shopMoney: Pick<import("../../generated-api-types/2025-04/admin.types").MoneyV2, "amount" | "currencyCode">;
|
|
75
|
+
}>;
|
|
76
|
+
refunds: Array<{
|
|
77
|
+
totalRefundedSet: {
|
|
78
|
+
shopMoney: Pick<import("../../generated-api-types/2025-04/admin.types").MoneyV2, "amount" | "currencyCode">;
|
|
79
|
+
};
|
|
80
|
+
}>;
|
|
81
|
+
}> | undefined;
|
|
82
|
+
//# sourceMappingURL=getOrderById.mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrderById.mock.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,mDAAmD,CAAA;AAS1D,eAAO,MAAM,aAAa,EAAE,cAoC3B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BjC,CAAA;AAGD,eAAO,MAAM,iBAAiB,EAAE,kBAkI/B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;qBA9F5B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8FsD,CAAA"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { CurrencyCode, FulfillmentStatus, OrderDisplayFinancialStatus, OrderDisplayFulfillmentStatus, } from '../../generated-api-types/2025-04/admin.types';
|
|
2
|
+
// Lean order mock
|
|
3
|
+
export const orderByIdMock = {
|
|
4
|
+
order: {
|
|
5
|
+
id: 'gid://shopify/Order/12345678901234',
|
|
6
|
+
name: 'B12345',
|
|
7
|
+
createdAt: '2023-09-19T16:15:23Z',
|
|
8
|
+
updatedAt: '2023-09-20T02:13:52Z',
|
|
9
|
+
cancelledAt: null,
|
|
10
|
+
cancelReason: null,
|
|
11
|
+
displayFinancialStatus: OrderDisplayFinancialStatus.Paid,
|
|
12
|
+
displayFulfillmentStatus: OrderDisplayFulfillmentStatus.Fulfilled,
|
|
13
|
+
totalPriceSet: {
|
|
14
|
+
shopMoney: {
|
|
15
|
+
amount: '139.0',
|
|
16
|
+
currencyCode: CurrencyCode.Eur,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
customer: {
|
|
20
|
+
id: 'gid://shopify/Customer/98765432101234',
|
|
21
|
+
lastName: 'Doe',
|
|
22
|
+
displayName: 'John Doe',
|
|
23
|
+
firstName: 'John',
|
|
24
|
+
defaultEmailAddress: {
|
|
25
|
+
emailAddress: 'john.doe@example.com',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
shippingAddress: {
|
|
29
|
+
firstName: 'John',
|
|
30
|
+
lastName: 'Doe',
|
|
31
|
+
address1: '123 Main Street',
|
|
32
|
+
address2: 'Apt 4B',
|
|
33
|
+
city: 'Berlin',
|
|
34
|
+
province: 'Berlin',
|
|
35
|
+
country: 'Germany',
|
|
36
|
+
zip: '10115',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const expectedLeanOrderById = {
|
|
41
|
+
id: 'gid://shopify/Order/12345678901234',
|
|
42
|
+
name: 'B12345',
|
|
43
|
+
createdAt: '2023-09-19T16:15:23Z',
|
|
44
|
+
updatedAt: '2023-09-20T02:13:52Z',
|
|
45
|
+
cancelledAt: null,
|
|
46
|
+
cancelReason: null,
|
|
47
|
+
totalPrice: {
|
|
48
|
+
amount: '139.0',
|
|
49
|
+
currencyCode: 'EUR',
|
|
50
|
+
},
|
|
51
|
+
customer: {
|
|
52
|
+
id: 'gid://shopify/Customer/98765432101234',
|
|
53
|
+
displayName: 'John Doe',
|
|
54
|
+
firstName: 'John',
|
|
55
|
+
lastName: 'Doe',
|
|
56
|
+
emailAddress: 'john.doe@example.com',
|
|
57
|
+
},
|
|
58
|
+
financialStatus: 'PAID',
|
|
59
|
+
fulfillmentStatus: 'FULFILLED',
|
|
60
|
+
shippingAddress: {
|
|
61
|
+
firstName: 'John',
|
|
62
|
+
lastName: 'Doe',
|
|
63
|
+
address1: '123 Main Street',
|
|
64
|
+
address2: 'Apt 4B',
|
|
65
|
+
city: 'Berlin',
|
|
66
|
+
province: 'Berlin',
|
|
67
|
+
country: 'Germany',
|
|
68
|
+
zip: '10115',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
// Full order mock
|
|
72
|
+
export const orderByIdFullMock = {
|
|
73
|
+
order: {
|
|
74
|
+
id: 'gid://shopify/Order/12345678901234',
|
|
75
|
+
name: 'B12345',
|
|
76
|
+
createdAt: '2023-09-19T16:15:23Z',
|
|
77
|
+
updatedAt: '2023-09-20T02:13:52Z',
|
|
78
|
+
processedAt: '2023-09-19T16:15:23Z',
|
|
79
|
+
closedAt: '2023-09-21T10:00:00Z',
|
|
80
|
+
cancelledAt: null,
|
|
81
|
+
cancelReason: null,
|
|
82
|
+
displayFinancialStatus: OrderDisplayFinancialStatus.Paid,
|
|
83
|
+
displayFulfillmentStatus: OrderDisplayFulfillmentStatus.Fulfilled,
|
|
84
|
+
discountCodes: [],
|
|
85
|
+
totalPriceSet: {
|
|
86
|
+
shopMoney: {
|
|
87
|
+
amount: '139.0',
|
|
88
|
+
currencyCode: CurrencyCode.Eur,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
customer: {
|
|
92
|
+
id: 'gid://shopify/Customer/98765432101234',
|
|
93
|
+
firstName: 'John',
|
|
94
|
+
lastName: 'Doe',
|
|
95
|
+
email: 'john.doe@example.com',
|
|
96
|
+
phone: '+49123456789',
|
|
97
|
+
},
|
|
98
|
+
shippingAddress: {
|
|
99
|
+
firstName: 'John',
|
|
100
|
+
lastName: 'Doe',
|
|
101
|
+
address1: '123 Main Street',
|
|
102
|
+
address2: 'Apt 4B',
|
|
103
|
+
city: 'Berlin',
|
|
104
|
+
province: 'Berlin',
|
|
105
|
+
country: 'Germany',
|
|
106
|
+
zip: '10115',
|
|
107
|
+
},
|
|
108
|
+
billingAddress: {
|
|
109
|
+
firstName: 'John',
|
|
110
|
+
lastName: 'Doe',
|
|
111
|
+
address1: '123 Main Street',
|
|
112
|
+
address2: 'Apt 4B',
|
|
113
|
+
city: 'Berlin',
|
|
114
|
+
province: 'Berlin',
|
|
115
|
+
country: 'Germany',
|
|
116
|
+
zip: '10115',
|
|
117
|
+
},
|
|
118
|
+
lineItems: {
|
|
119
|
+
edges: [
|
|
120
|
+
{
|
|
121
|
+
node: {
|
|
122
|
+
id: 'gid://shopify/LineItem/111111111111',
|
|
123
|
+
sku: 'MATTRESS-001',
|
|
124
|
+
title: 'Premium Mattress',
|
|
125
|
+
variantTitle: 'Queen Size',
|
|
126
|
+
quantity: 1,
|
|
127
|
+
customAttributes: [{ key: 'color', value: 'white' }],
|
|
128
|
+
originalUnitPriceSet: {
|
|
129
|
+
shopMoney: {
|
|
130
|
+
amount: '129.0',
|
|
131
|
+
currencyCode: CurrencyCode.Eur,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
vendor: 'Ehrenkind',
|
|
135
|
+
image: {
|
|
136
|
+
url: 'https://cdn.shopify.com/mattress.jpg',
|
|
137
|
+
width: 800,
|
|
138
|
+
height: 600,
|
|
139
|
+
altText: 'Premium Mattress',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
fulfillments: [
|
|
146
|
+
{
|
|
147
|
+
id: 'gid://shopify/Fulfillment/222222222222',
|
|
148
|
+
name: '#B12345.1',
|
|
149
|
+
totalQuantity: 1,
|
|
150
|
+
status: FulfillmentStatus.Success,
|
|
151
|
+
createdAt: '2023-09-20T08:00:00Z',
|
|
152
|
+
estimatedDeliveryAt: '2023-09-22T12:00:00Z',
|
|
153
|
+
deliveredAt: '2023-09-21T10:00:00Z',
|
|
154
|
+
trackingInfo: [
|
|
155
|
+
{
|
|
156
|
+
company: 'DHL',
|
|
157
|
+
number: '123456789012',
|
|
158
|
+
url: 'https://tracking.dhl.com/123456789012',
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
fulfillmentLineItems: {
|
|
162
|
+
edges: [
|
|
163
|
+
{
|
|
164
|
+
node: {
|
|
165
|
+
id: 'gid://shopify/FulfillmentLineItem/333333333333',
|
|
166
|
+
quantity: 1,
|
|
167
|
+
lineItem: {
|
|
168
|
+
id: 'gid://shopify/LineItem/111111111111',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
shippingLine: {
|
|
177
|
+
originalPriceSet: {
|
|
178
|
+
shopMoney: {
|
|
179
|
+
amount: '10.0',
|
|
180
|
+
currencyCode: CurrencyCode.Eur,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
taxLines: [
|
|
185
|
+
{
|
|
186
|
+
priceSet: {
|
|
187
|
+
shopMoney: {
|
|
188
|
+
amount: '22.19',
|
|
189
|
+
currencyCode: CurrencyCode.Eur,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
totalDiscountsSet: {
|
|
195
|
+
shopMoney: {
|
|
196
|
+
amount: '0.0',
|
|
197
|
+
currencyCode: CurrencyCode.Eur,
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
refunds: [],
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
export const expectedFullOrderById = orderByIdFullMock.order;
|
|
204
|
+
//# sourceMappingURL=getOrderById.mock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrderById.mock.js","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.mock.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,+CAA+C,CAAA;AAEtD,kBAAkB;AAClB,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,KAAK,EAAE;QACL,EAAE,EAAE,oCAAoC;QACxC,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,sBAAsB;QACjC,SAAS,EAAE,sBAAsB;QACjC,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,IAAI;QAClB,sBAAsB,EAAE,2BAA2B,CAAC,IAAI;QACxD,wBAAwB,EAAE,6BAA6B,CAAC,SAAS;QACjE,aAAa,EAAE;YACb,SAAS,EAAE;gBACT,MAAM,EAAE,OAAO;gBACf,YAAY,EAAE,YAAY,CAAC,GAAG;aAC/B;SACF;QACD,QAAQ,EAAE;YACR,EAAE,EAAE,uCAAuC;YAC3C,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,UAAU;YACvB,SAAS,EAAE,MAAM;YACjB,mBAAmB,EAAE;gBACnB,YAAY,EAAE,sBAAsB;aACrC;SACF;QACD,eAAe,EAAE;YACf,SAAS,EAAE,MAAM;YACjB,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,iBAAiB;YAC3B,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,SAAS;YAClB,GAAG,EAAE,OAAO;SACb;KACF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,EAAE,EAAE,oCAAoC;IACxC,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,sBAAsB;IACjC,SAAS,EAAE,sBAAsB;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E,OAAO,EAAE,KAAK;wBACd,MAAM,EAAE,cAAc;wBACtB,GAAG,EAAE,uCAAuC;qBAC7C;iBACF;gBACD,oBAAoB,EAAE;oBACpB,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE;gCACJ,EAAE,EAAE,gDAAgD;gCACpD,QAAQ,EAAE,CAAC;gCACX,QAAQ,EAAE;oCACR,EAAE,EAAE,qCAAqC;iCAC1C;6BACF;yBACF;qBACF;iBACF;aACF;SACF;QACD,YAAY,EAAE;YACZ,gBAAgB,EAAE;gBAChB,SAAS,EAAE;oBACT,MAAM,EAAE,MAAM;oBACd,YAAY,EAAE,YAAY,CAAC,GAAG;iBAC/B;aACF;SACF;QACD,QAAQ,EAAE;YACR;gBACE,QAAQ,EAAE;oBACR,SAAS,EAAE;wBACT,MAAM,EAAE,OAAO;wBACf,YAAY,EAAE,YAAY,CAAC,GAAG;qBAC/B;iBACF;aACF;SACF;QACD,iBAAiB,EAAE;YACjB,SAAS,EAAE;gBACT,MAAM,EAAE,KAAK;gBACb,YAAY,EAAE,YAAY,CAAC,GAAG;aAC/B;SACF;QACD,OAAO,EAAE,EAAE;KACZ;CACF,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,KAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrderById.queries.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.queries.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAsC1B,CAAA;AAED,eAAO,MAAM,kBAAkB,QAoI9B,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { gql } from '../../utils/logger';
|
|
2
|
+
export const queryOrderById = gql `#graphql
|
|
3
|
+
query orderById($id: ID!) {
|
|
4
|
+
order(id: $id) {
|
|
5
|
+
id
|
|
6
|
+
name
|
|
7
|
+
createdAt
|
|
8
|
+
updatedAt
|
|
9
|
+
cancelledAt
|
|
10
|
+
cancelReason
|
|
11
|
+
totalPriceSet {
|
|
12
|
+
shopMoney {
|
|
13
|
+
amount
|
|
14
|
+
currencyCode
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
customer {
|
|
18
|
+
id
|
|
19
|
+
lastName
|
|
20
|
+
defaultEmailAddress {
|
|
21
|
+
emailAddress
|
|
22
|
+
}
|
|
23
|
+
displayName
|
|
24
|
+
firstName
|
|
25
|
+
}
|
|
26
|
+
displayFinancialStatus
|
|
27
|
+
displayFulfillmentStatus
|
|
28
|
+
shippingAddress {
|
|
29
|
+
firstName
|
|
30
|
+
lastName
|
|
31
|
+
address1
|
|
32
|
+
address2
|
|
33
|
+
city
|
|
34
|
+
province
|
|
35
|
+
country
|
|
36
|
+
zip
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
export const queryOrderByIdFull = gql `#graphql
|
|
42
|
+
query orderByIdFull($id: ID!) {
|
|
43
|
+
order(id: $id) {
|
|
44
|
+
id
|
|
45
|
+
name
|
|
46
|
+
createdAt
|
|
47
|
+
updatedAt
|
|
48
|
+
processedAt
|
|
49
|
+
closedAt
|
|
50
|
+
cancelledAt
|
|
51
|
+
cancelReason
|
|
52
|
+
totalPriceSet {
|
|
53
|
+
shopMoney {
|
|
54
|
+
amount
|
|
55
|
+
currencyCode
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
customer {
|
|
59
|
+
id
|
|
60
|
+
firstName
|
|
61
|
+
lastName
|
|
62
|
+
email
|
|
63
|
+
phone
|
|
64
|
+
}
|
|
65
|
+
displayFinancialStatus
|
|
66
|
+
displayFulfillmentStatus
|
|
67
|
+
shippingAddress {
|
|
68
|
+
firstName
|
|
69
|
+
lastName
|
|
70
|
+
address1
|
|
71
|
+
address2
|
|
72
|
+
city
|
|
73
|
+
province
|
|
74
|
+
country
|
|
75
|
+
zip
|
|
76
|
+
}
|
|
77
|
+
billingAddress {
|
|
78
|
+
firstName
|
|
79
|
+
lastName
|
|
80
|
+
address1
|
|
81
|
+
address2
|
|
82
|
+
city
|
|
83
|
+
province
|
|
84
|
+
country
|
|
85
|
+
zip
|
|
86
|
+
}
|
|
87
|
+
lineItems(first: 100) {
|
|
88
|
+
edges {
|
|
89
|
+
node {
|
|
90
|
+
id
|
|
91
|
+
sku
|
|
92
|
+
title
|
|
93
|
+
variantTitle
|
|
94
|
+
quantity
|
|
95
|
+
customAttributes {
|
|
96
|
+
key
|
|
97
|
+
value
|
|
98
|
+
}
|
|
99
|
+
originalUnitPriceSet {
|
|
100
|
+
shopMoney {
|
|
101
|
+
amount
|
|
102
|
+
currencyCode
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
vendor
|
|
106
|
+
image {
|
|
107
|
+
url
|
|
108
|
+
width
|
|
109
|
+
height
|
|
110
|
+
altText
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
fulfillments {
|
|
116
|
+
id
|
|
117
|
+
name
|
|
118
|
+
totalQuantity
|
|
119
|
+
status
|
|
120
|
+
createdAt
|
|
121
|
+
estimatedDeliveryAt
|
|
122
|
+
deliveredAt
|
|
123
|
+
trackingInfo {
|
|
124
|
+
company
|
|
125
|
+
number
|
|
126
|
+
url
|
|
127
|
+
}
|
|
128
|
+
fulfillmentLineItems(first: 100) {
|
|
129
|
+
edges {
|
|
130
|
+
node {
|
|
131
|
+
id
|
|
132
|
+
quantity
|
|
133
|
+
lineItem {
|
|
134
|
+
id
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
shippingLine {
|
|
141
|
+
originalPriceSet {
|
|
142
|
+
shopMoney {
|
|
143
|
+
amount
|
|
144
|
+
currencyCode
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
taxLines {
|
|
149
|
+
priceSet {
|
|
150
|
+
shopMoney {
|
|
151
|
+
amount
|
|
152
|
+
currencyCode
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
totalDiscountsSet {
|
|
157
|
+
shopMoney {
|
|
158
|
+
amount
|
|
159
|
+
currencyCode
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
discountCodes
|
|
163
|
+
refunds {
|
|
164
|
+
totalRefundedSet {
|
|
165
|
+
shopMoney {
|
|
166
|
+
amount
|
|
167
|
+
currencyCode
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
//# sourceMappingURL=getOrderById.queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrderById.queries.js","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsChC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIpC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrderById.test.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { graphql, passthrough } from 'msw';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { server } from '../../utils/mswHandlers';
|
|
4
|
+
import { getOrderById } from './getOrderById';
|
|
5
|
+
import { expectedFullOrderById, expectedLeanOrderById, } from './getOrderById.mock';
|
|
6
|
+
describe('getOrderById', () => {
|
|
7
|
+
describe('lean (default)', () => {
|
|
8
|
+
it('should return lean order when found', async () => {
|
|
9
|
+
const result = await getOrderById(12345678901234n);
|
|
10
|
+
expect(result).toEqual(expectedLeanOrderById);
|
|
11
|
+
});
|
|
12
|
+
it('should return lean order when explicitly requested', async () => {
|
|
13
|
+
const result = await getOrderById(12345678901234n, 'lean');
|
|
14
|
+
expect(result).toEqual(expectedLeanOrderById);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe('full', () => {
|
|
18
|
+
it('should return full order when requested', async () => {
|
|
19
|
+
const result = await getOrderById(12345678901234n, 'full');
|
|
20
|
+
expect(result).toEqual(expectedFullOrderById);
|
|
21
|
+
});
|
|
22
|
+
it('should include lineItems in full order', async () => {
|
|
23
|
+
const result = await getOrderById(12345678901234n, 'full');
|
|
24
|
+
expect(result?.lineItems.edges).toHaveLength(1);
|
|
25
|
+
expect(result?.lineItems.edges[0]?.node.sku).toBe('MATTRESS-001');
|
|
26
|
+
});
|
|
27
|
+
it('should include fulfillments in full order', async () => {
|
|
28
|
+
const result = await getOrderById(12345678901234n, 'full');
|
|
29
|
+
expect(result?.fulfillments).toHaveLength(1);
|
|
30
|
+
expect(result?.fulfillments?.[0]?.trackingInfo[0]?.company).toBe('DHL');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('Live', () => {
|
|
34
|
+
it('should return null when order not found (lean)', async () => {
|
|
35
|
+
server.use(graphql.query('orderById', () => passthrough()));
|
|
36
|
+
const result = await getOrderById(99999999999n);
|
|
37
|
+
expect(result).toBeNull();
|
|
38
|
+
});
|
|
39
|
+
it('should return null when order not found (full)', async () => {
|
|
40
|
+
server.use(graphql.query('orderByIdFull', () => passthrough()));
|
|
41
|
+
const result = await getOrderById(99999999999n, 'full');
|
|
42
|
+
expect(result).toBeNull();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=getOrderById.test.js.map
|