@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
27 lines • 1.5 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
const fetchCurrencyAll_1 = require("../fetchCurrencyAll");
const fetchCurrencyAll_mocks_1 = require("../__mocks__/fetchCurrencyAll.mocks");
const timeout_1 = require("../../../const/timeout");
const flattenV5CurrenciesAll_1 = require("../../../utils/flattenV5CurrenciesAll");
jest.mock("@ledgerhq/live-network/network");
describe("fetchCurrencyAll", () => {
it("success with 200", async () => {
network_1.default.mockImplementation(() => ({
data: fetchCurrencyAll_mocks_1.fetchCurrencyAllMock,
}));
const providers = ["changelly", "cic", "moonpay", "oneinch", "paraswap"];
const result = await (0, fetchCurrencyAll_1.fetchCurrencyAll)({ providers });
expect(result).toStrictEqual((0, flattenV5CurrenciesAll_1.flattenV5CurrenciesAll)(fetchCurrencyAll_mocks_1.fetchCurrencyAllMock));
expect(network_1.default).toHaveBeenCalledWith({
method: "GET",
timeout: timeout_1.DEFAULT_SWAP_TIMEOUT_MS,
url: "https://swap.ledger.com/v5/currencies/all?providers-whitelist=changelly%2Ccic%2Cmoonpay%2Coneinch%2Cparaswap&additional-coins-flag=false",
});
});
});
//# sourceMappingURL=fetchCurrencyAll.spec.js.map