diff --git a/src/internal/fetch/index.ts b/src/internal/fetch/index.ts index 451dd32..a61e597 100644 --- a/src/internal/fetch/index.ts +++ b/src/internal/fetch/index.ts @@ -84,7 +84,10 @@ export async function $fetch(options: FetchOptions, needApiKey = true) { Object.assign(response, { error: error as Error }); } - response.error && onError?.(response.error); + if (response.error) { + onError?.(response.error); + } + return response as FetchResponse; } diff --git a/test/index.test.ts b/test/index.test.ts index 110f986..1cf8a93 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -41,6 +41,7 @@ describe("Export", () => { "getOrder", "listOrders", "generateOrderInvoice", + "issueOrderRefund", // Order Items "getOrderItem", @@ -56,6 +57,7 @@ describe("Export", () => { "getSubscriptionInvoice", "listSubscriptionInvoices", "generateSubscriptionInvoice", + "issueSubscriptionInvoiceRefund", // Subscriptions Items "getSubscriptionItem", diff --git a/test/products/index.test.ts b/test/products/index.test.ts index f711ab6..3d4eca0 100644 --- a/test/products/index.test.ts +++ b/test/products/index.test.ts @@ -145,8 +145,8 @@ describe("Retrieve a product", () => { const { id, type, attributes, relationships } = data; expect(id).toEqual(productId.toString()); expect(type).toEqual(DATA_TYPE); - expect(attributes).toBeDefined; - expect(relationships).toBeDefined; + expect(attributes).toBeDefined(); + expect(relationships).toBeDefined(); const { store_id, @@ -222,8 +222,8 @@ describe("Retrieve a product", () => { const { id, type, attributes, relationships } = data; expect(id).toEqual(productId.toString()); expect(type).toEqual(DATA_TYPE); - expect(attributes).toBeDefined; - expect(relationships).toBeDefined; + expect(attributes).toBeDefined(); + expect(relationships).toBeDefined(); const { store_id, diff --git a/test/subscriptions/index.test.ts b/test/subscriptions/index.test.ts index cdb4bbd..c7e04c9 100644 --- a/test/subscriptions/index.test.ts +++ b/test/subscriptions/index.test.ts @@ -39,7 +39,7 @@ describe("List all subscriptions", () => { // Get active subscription const activeSubscription = data.find((d) => { - d.attributes.status === "active"; + return d.attributes.status === "active"; }); const { id, attributes } = activeSubscription ?? data[0];