UNPKG

@ledgerhq/live-common

Version:
42 lines 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); require("../../__tests__/test-helpers/setup"); const operators_1 = require("rxjs/operators"); const account_1 = require("../../account"); const bridge_1 = require("../../bridge"); const cache_1 = require("../../bridge/cache"); const multiversx1_1 = require("./datasets/multiversx1"); const rxjs_1 = require("rxjs"); describe("ESDT tokens sync functionality", () => { let account; const localCache = {}; const cache = (0, cache_1.makeBridgeCacheSystem)({ saveData(c, d) { localCache[c.id] = d; return Promise.resolve(); }, getData(c) { return Promise.resolve(localCache[c.id]); }, }); beforeAll(async () => { account = await (0, account_1.fromAccountRaw)(multiversx1_1.multiversx1); }); test("initial raw account contains no token accounts", async () => { await cache.prepareCurrency(account.currency); expect(multiversx1_1.multiversx1.subAccounts?.length).toBeFalsy(); }); test("sync finds tokens", async () => { const bridge = (0, bridge_1.getAccountBridge)(account); const synced = await (0, rxjs_1.firstValueFrom)(bridge .sync(account, { paginationConfig: {}, }) .pipe((0, operators_1.reduce)((a, f) => f(a), account))); // Contains token accounts expect(synced.subAccounts?.length).toBeTruthy(); // Contains a known token expect(synced.subAccounts.find(a => (0, account_1.getAccountCurrency)(a)?.id === "multiversx/esdt/4d45582d343535633537")).toBeTruthy(); }); }); //# sourceMappingURL=synchronisation.integration.test.js.map