From a2668c22f0d18386fc988f27299172145d9fa15d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 3 Jan 2023 01:57:39 -0300 Subject: refactor better QA removed axios, use fetch removed jest, added mocha and chai moved the default request handler to runtime dependency (so it can be replaced for testing) refactored ALL the test to the standard web-utils all hooks now use ONE request handler moved the tests from test folder to src --- .../src/paths/instance/reserves/create/CreatePage.tsx | 9 ++++----- .../src/paths/instance/reserves/details/index.tsx | 2 +- .../src/paths/instance/reserves/list/index.tsx | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/paths/instance/reserves') diff --git a/packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatePage.tsx index de2319636..ad0cca74a 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatePage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/reserves/create/CreatePage.tsx @@ -31,7 +31,7 @@ import { Input } from "../../../../components/form/Input.js"; import { InputCurrency } from "../../../../components/form/InputCurrency.js"; import { InputSelector } from "../../../../components/form/InputSelector.js"; import { ExchangeBackend, MerchantBackend } from "../../../../declaration.js"; -import { request } from "../../../../hooks/backend.js"; +// import { request } from "../../../../utils/request.js"; import { PAYTO_WIRE_METHOD_LOOKUP, URL_REGEX, @@ -124,11 +124,10 @@ function ViewStep({ { - return request( - `${reserve.exchange_url}wire`, - ) + return fetch(`${reserve.exchange_url}wire`) + .then((r) => r.json()) .then((r) => { - const wireMethods = r.data.accounts.map((a) => { + const wireMethods = r.data.accounts.map((a: any) => { const match = PAYTO_WIRE_METHOD_LOOKUP.exec(a.payto_uri); return (match && match[1]) || ""; }); diff --git a/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx index b13b075fd..57ee566d1 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/index.tsx @@ -21,7 +21,7 @@ import { Fragment, h, VNode } from "preact"; import { Loading } from "../../../../components/exception/loading.js"; -import { HttpError } from "../../../../hooks/backend.js"; +import { HttpError } from "../../../../utils/request.js"; import { useReserveDetails } from "../../../../hooks/reserves.js"; import { DetailPage } from "./DetailPage.js"; diff --git a/packages/merchant-backoffice-ui/src/paths/instance/reserves/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/reserves/list/index.tsx index 9c3255ee8..597bde167 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/reserves/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/reserves/list/index.tsx @@ -25,7 +25,7 @@ import { useState } from "preact/hooks"; import { Loading } from "../../../../components/exception/loading.js"; import { NotificationCard } from "../../../../components/menu/index.js"; import { MerchantBackend } from "../../../../declaration.js"; -import { HttpError } from "../../../../hooks/backend.js"; +import { HttpError } from "../../../../utils/request.js"; import { useInstanceReserves, useReservesAPI, -- cgit v1.2.3