@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
46 lines • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const sortByMarketcap_1 = require("./sortByMarketcap");
const _1 = require(".");
const mock_1 = require("@ledgerhq/live-countervalues/mock");
const mock_2 = require("./mock");
const index_1 = require("@ledgerhq/coin-framework/crypto-assets/index");
const findCurrencyByTicker_1 = require("@ledgerhq/live-countervalues/findCurrencyByTicker");
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
(0, index_1.setCryptoAssetsStore)({});
test("sortCurrenciesByIds snapshot", () => {
const list = [...(0, _1.listCryptoCurrencies)(), ...(0, _1.listTokens)()];
const ids = [];
for (const k in (0, mock_1.getBTCValues)()) {
const c = (0, findCurrencyByTicker_1.findCurrencyByTicker)(k);
if (c && (c.type == "CryptoCurrency" || c.type == "TokenCurrency")) {
ids.push(c.id);
}
}
expect((0, sortByMarketcap_1.sortCurrenciesByIds)(list, ids).map(c => c.id)[0]).toEqual("bitcoin");
});
test("sortCurrenciesByIds simulate staking from portfolio", () => {
expect((0, sortByMarketcap_1.sortCurrenciesByIds)(mock_2.CURRENCIES_LIST, mock_2.IDS).map(c => c.id)).toEqual([
"ethereum",
"solana",
"cardano",
"polkadot",
"cosmos",
"near",
"injective",
"elrond",
"tezos",
"celo",
"osmo",
"axelar",
"persistence",
"onomy",
"mantra",
"crypto_org",
"xion",
"zenrock",
"babylon",
"quicksilver",
]);
});
//# sourceMappingURL=sortByMarketcap.test.js.map