UNPKG

@ledgerhq/coin-tezos

Version:
52 lines 2.04 kB
import { fromAccountRaw } from "@ledgerhq/coin-framework/serialization"; import { loadAccountDelegation, listBakers } from "../network/bakers"; import whitelist from "../network/bakers.whitelist-default"; import coinConfig from "../config"; import { mockConfig } from "../test/config"; function makeAccountRaw(name, pubkey, address, derivationMode) { return { id: `js:2:tezos:${pubkey}:${derivationMode}`, seedIdentifier: address, name: "Tezos " + name, derivationMode, index: 0, freshAddress: address, freshAddressPath: "", blockHeight: 0, operations: [], pendingOperations: [], currencyId: "tezos", lastSyncDate: "", balance: "0", xpub: pubkey, subAccounts: [], tezosResources: { revealed: true, counter: 0 }, }; } const accountTZrevealedDelegating = makeAccountRaw("TZrevealedDelegating", "02389ffd73423626894cb151416e51c72ec285376673daf83545eb5edb45b261ce", "tz1boBHAVpwcvKkNFAQHYr7mjxAz1PpVgKq7", "tezbox"); describe("tezos bakers", () => { beforeAll(() => { coinConfig.setCoinConfig(() => mockConfig); }); test("atleast 10 whitelisted bakers are online", async () => { const bakers = await listBakers(whitelist); const retrievedAddresses = bakers.map(o => o.address); let available = 0; for (const whitelisted of whitelist) { if (retrievedAddresses.includes(whitelisted)) { available++; } else { console.warn(`Baker ${whitelisted} no longer online !`); } } expect(available).toBeGreaterThan(10); }); // TODO we'll need two accounts to test diff cases test("load account baker info", async () => { const account = fromAccountRaw(accountTZrevealedDelegating); const delegation = await loadAccountDelegation(account); expect(delegation).toBe(null); }); }); //# sourceMappingURL=bakers.integration.test.js.map