From ab9ce29b56f5f8d8bfa16570e56cfe13810cad6a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 9 Nov 2023 10:00:24 -0300 Subject: update test for "limit=0" optimization --- .../src/hooks/transfer.test.ts | 29 +++------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/hooks/transfer.test.ts') diff --git a/packages/merchant-backoffice-ui/src/hooks/transfer.test.ts b/packages/merchant-backoffice-ui/src/hooks/transfer.test.ts index 10cb4226b..a7187af27 100644 --- a/packages/merchant-backoffice-ui/src/hooks/transfer.test.ts +++ b/packages/merchant-backoffice-ui/src/hooks/transfer.test.ts @@ -30,19 +30,10 @@ describe("transfer api interaction with listing", () => { it("should evict cache when informing a transfer", async () => { const env = new ApiMockEnvironment(); - env.addRequestExpectation(API_LIST_TRANSFERS, { - qparam: { limit: 0 }, - response: { - transfers: [{ wtid: "2" } as MerchantBackend.Transfers.TransferDetails], - }, - }); - // FIXME: is this query really needed? if the hook is rendered without - // position argument then then backend is returning the newest and no need - // to this second query env.addRequestExpectation(API_LIST_TRANSFERS, { qparam: { limit: -20 }, response: { - transfers: [], + transfers: [{ wtid: "2" } as MerchantBackend.Transfers.TransferDetails], }, }); @@ -83,17 +74,10 @@ describe("transfer api interaction with listing", () => { response: { total: "" } as any, }); - env.addRequestExpectation(API_LIST_TRANSFERS, { - qparam: { limit: 0 }, - response: { - transfers: [{ wtid: "2" } as any, { wtid: "3" } as any], - }, - }); - env.addRequestExpectation(API_LIST_TRANSFERS, { qparam: { limit: -20 }, response: { - transfers: [], + transfers: [{ wtid: "3" } as any, { wtid: "2" } as any], }, }); @@ -129,17 +113,10 @@ describe("transfer listing pagination", () => { it("should not load more if has reach the end", async () => { const env = new ApiMockEnvironment(); - env.addRequestExpectation(API_LIST_TRANSFERS, { - qparam: { limit: 0, payto_uri: "payto://" }, - response: { - transfers: [{ wtid: "2" } as any], - }, - }); - env.addRequestExpectation(API_LIST_TRANSFERS, { qparam: { limit: -20, payto_uri: "payto://" }, response: { - transfers: [{ wtid: "1" } as any], + transfers: [{ wtid: "2" }, { wtid: "1" } as any], }, }); -- cgit v1.2.3