UNPKG

@ledgerhq/coin-tezos

Version:
65 lines 2.29 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const estimateFees_1 = require("./estimateFees"); const config_1 = __importDefault(require("../config")); const config_2 = require("../test/config"); describe("estimateFees", () => { beforeAll(() => { config_1.default.setCoinConfig(() => config_2.mockConfig); }); const accounts = [ { xpub: "02389ffd73423626894cb151416e51c72ec285376673daf83545eb5edb45b261ce", address: "tz1UHux4ijk2Qu6Ee3dDpka4vnAiEhiDLZMa", balance: BigInt("2000000"), revealed: false, }, { // No xpub provided address: "tz1UHux4ijk2Qu6Ee3dDpka4vnAiEhiDLZMa", balance: BigInt("2000000"), revealed: false, }, ]; it.each(accounts)("returns correct value", async (account) => { // Given const transaction = { mode: "send", recipient: "tz1PWFt4Ym6HedY78MgUP2kVDtSampGwprs5", amount: BigInt(1_000_000), }; // When const result = await (0, estimateFees_1.estimateFees)({ account, transaction }); // Then expect(result).toEqual({ estimatedFees: BigInt("866"), fees: BigInt("492"), gasLimit: BigInt("2169"), storageLimit: BigInt("277"), amount: BigInt("1000000"), }); }); it.each(accounts)("returns correct value when useAllAmount", async (account) => { // Given const transaction = { mode: "send", recipient: "tz1PWFt4Ym6HedY78MgUP2kVDtSampGwprs5", amount: BigInt(1_000_000), useAllAmount: true, }; // When const result = await (0, estimateFees_1.estimateFees)({ account, transaction }); // Then expect(result).toEqual({ estimatedFees: BigInt("864"), fees: BigInt("490"), gasLimit: BigInt("2169"), storageLimit: BigInt("277"), amount: BigInt("1934589"), }); }); }); //# sourceMappingURL=estimateFees.integ.test.js.map