diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/hooks/product.test.ts')
-rw-r--r-- | packages/merchant-backoffice-ui/src/hooks/product.test.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/packages/merchant-backoffice-ui/src/hooks/product.test.ts b/packages/merchant-backoffice-ui/src/hooks/product.test.ts index 64dbd0103..c819c739e 100644 --- a/packages/merchant-backoffice-ui/src/hooks/product.test.ts +++ b/packages/merchant-backoffice-ui/src/hooks/product.test.ts @@ -23,7 +23,6 @@ import * as tests from "@gnu-taler/web-util/testing"; import { expect } from "chai"; import { useInstanceProducts, - useProductAPI, useProductDetails, } from "./product.js"; import { ApiMockEnvironment } from "./testing.js"; @@ -35,6 +34,7 @@ import { API_UPDATE_PRODUCT_BY_ID, } from "./urls.js"; import { TalerMerchantApi } from "@gnu-taler/taler-util"; +import { useMerchantApiContext } from "@gnu-taler/web-util/browser"; describe("product api interaction with listing", () => { it("should evict cache when creating a product", async () => { @@ -52,7 +52,7 @@ describe("product api interaction with listing", () => { const hookBehavior = await tests.hookBehaveLikeThis( () => { const query = useInstanceProducts(); - const api = useProductAPI(); + const { lib: api } = useMerchantApiContext(); return { query, api }; }, {}, @@ -70,7 +70,7 @@ describe("product api interaction with listing", () => { expect(query.loading).undefined; expect(query.ok).true; if (!query.ok) return; - expect(query.data).deep.equals([{ id: "1234" , price: "ARS:12" }]); + expect(query.data).deep.equals([{ id: "1234", price: "ARS:12" }]); env.addRequestExpectation(API_CREATE_PRODUCT, { request: { @@ -99,7 +99,7 @@ describe("product api interaction with listing", () => { } as TalerMerchantApi.ProductDetail, }); - api.createProduct({ + api.management.addProduct(undefined, { price: "ARS:23", } as any); }, @@ -150,7 +150,7 @@ describe("product api interaction with listing", () => { const hookBehavior = await tests.hookBehaveLikeThis( () => { const query = useInstanceProducts(); - const api = useProductAPI(); + const { lib: api } = useMerchantApiContext(); return { query, api }; }, {}, @@ -187,7 +187,7 @@ describe("product api interaction with listing", () => { } as TalerMerchantApi.ProductDetail, }); - api.updateProduct("1234", { + api.management.updateProduct(undefined, "1234", { price: "ARS:13", } as any); }, @@ -218,7 +218,7 @@ describe("product api interaction with listing", () => { env.addRequestExpectation(API_LIST_PRODUCTS, { response: { - products: [{ product_id: "1234" , product_serial: 1}, { product_id: "2345", product_serial: 2 }], + products: [{ product_id: "1234", product_serial: 1 }, { product_id: "2345", product_serial: 2 }], }, }); env.addRequestExpectation(API_GET_PRODUCT_BY_ID("1234"), { @@ -231,7 +231,7 @@ describe("product api interaction with listing", () => { const hookBehavior = await tests.hookBehaveLikeThis( () => { const query = useInstanceProducts(); - const api = useProductAPI(); + const { lib: api } = useMerchantApiContext(); return { query, api }; }, {}, @@ -267,7 +267,7 @@ describe("product api interaction with listing", () => { price: "ARS:12", } as TalerMerchantApi.ProductDetail, }); - api.deleteProduct("2345"); + api.management.deleteProduct(undefined, "2345"); }, ({ query, api }) => { expect(env.assertJustExpectedRequestWereMade()).deep.eq({ @@ -306,7 +306,7 @@ describe("product api interaction with details", () => { const hookBehavior = await tests.hookBehaveLikeThis( () => { const query = useProductDetails("12"); - const api = useProductAPI(); + const { lib: api } = useMerchantApiContext(); return { query, api }; }, {}, @@ -337,7 +337,7 @@ describe("product api interaction with details", () => { } as TalerMerchantApi.ProductDetail, }); - api.updateProduct("12", { + api.management.updateProduct(undefined, "12", { description: "other description", } as any); }, |