From 18af86e81ebe1ef04c24b28c881e968a8b003a0d Mon Sep 17 00:00:00 2001 From: Albert Date: Sun, 31 Mar 2024 21:23:55 +1300 Subject: [PATCH] Finished Testing Deleted getProductsWithLookupKey method as products don't have lookup key values. Removed lookup key and metadata tests as they aren't necessary. --- .../business-layer/services/StripeService.test.ts | 15 --------------- .../src/business-layer/services/StripeService.ts | 7 ------- 2 files changed, 22 deletions(-) diff --git a/server/src/business-layer/services/StripeService.test.ts b/server/src/business-layer/services/StripeService.test.ts index d4d8b26ab..1cf1dc078 100644 --- a/server/src/business-layer/services/StripeService.test.ts +++ b/server/src/business-layer/services/StripeService.test.ts @@ -35,23 +35,8 @@ describe("Stripe service functionality", () => { expect(result.length).toEqual(4) }) - // should be using mock id? what's the point of testing again for the thing specified above it("should get a product by id", async () => { const result = await new StripeService().getProductById("random_id") expect(result).toEqual({ ...productMock, id: "random_id" }) }) - - // productMock doesn't have lookup key? - // it("should get a product with lookup key", async () => { - // const result = await new StripeService().getProductsWithLookupKey( - // "prod_NWjs8kKbJWmuuc" - // ) - // expect(result).toEqual(productMock) - // }) - - // productMock doesn't have metadata? - // it("should get a product by metadata", async () => { - // const result = await new StripeService().getProductByMetadata("", "") - // expect(result).toEqual(productMock) - // }) }) diff --git a/server/src/business-layer/services/StripeService.ts b/server/src/business-layer/services/StripeService.ts index 7ad9d621d..69a7a1ca3 100644 --- a/server/src/business-layer/services/StripeService.ts +++ b/server/src/business-layer/services/StripeService.ts @@ -3,13 +3,6 @@ import Stripe from "stripe" const stripe = new Stripe(process.env.STRIPE_API_KEY) export default class StripeService { - public async getProductsWithLookupKey(lookupKey: string) { - const result = await stripe.products.search({ - query: `lookup_key:'${lookupKey}'` - }) - return result.data - } - public async getAllProducts(limit?: number, startingAfter?: string) { const products = await stripe.products.list({ limit,