UNPKG

@ledgerhq/live-common

Version:
29 lines 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _1 = require("."); const LiveConfig_1 = require("@ledgerhq/live-config/LiveConfig"); describe("getCurrencyConfiguration", () => { let getValueByKeySpy; beforeEach(() => { getValueByKeySpy = jest.spyOn(LiveConfig_1.LiveConfig, "getValueByKey"); }); describe("when config fetching is successful", () => { it("should return the related currency config", async () => { const cosmosCurrencyMock = { family: "cosmos", id: "cosmos", }; getValueByKeySpy.mockReturnValueOnce(cosmosCurrencyMock); const config = (0, _1.getCurrencyConfiguration)(cosmosCurrencyMock); expect(config).toEqual(cosmosCurrencyMock); }); }); it("should return an error if currency config is null", async () => { getValueByKeySpy.mockReturnValueOnce(null); expect(() => (0, _1.getCurrencyConfiguration)({ id: "idontexistasacurrency", family: "ihavenofamily", })).toThrow(Error); }); }); //# sourceMappingURL=index.test.js.map