UNPKG

@ledgerhq/live-common

Version:
51 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 platformAdapter_1 = __importDefault(require("./platformAdapter")); const live_app_sdk_1 = require("@ledgerhq/live-app-sdk"); const bignumber_js_1 = __importDefault(require("bignumber.js")); describe("getPlatformTransactionSignFlowInfos", () => { describe("should properly get infos for DOT platform tx", () => { it("with most basic tx", () => { const dotPlatformTx = { family: live_app_sdk_1.FAMILIES.POLKADOT, amount: new bignumber_js_1.default(100000), recipient: "0xABCDEF", mode: "send", }; const expectedLiveTx = { family: dotPlatformTx.family, amount: dotPlatformTx.amount, recipient: dotPlatformTx.recipient, mode: dotPlatformTx.mode, }; const { canEditFees, hasFeesProvided, liveTx } = platformAdapter_1.default.getPlatformTransactionSignFlowInfos(dotPlatformTx); expect(canEditFees).toBe(false); expect(hasFeesProvided).toBe(false); expect(liveTx).toEqual(expectedLiveTx); }); it("with era provided", () => { const dotPlatformTx = { family: live_app_sdk_1.FAMILIES.POLKADOT, amount: new bignumber_js_1.default(100000), recipient: "0xABCDEF", mode: "send", era: 1, }; const expectedLiveTx = { family: dotPlatformTx.family, amount: dotPlatformTx.amount, recipient: dotPlatformTx.recipient, mode: dotPlatformTx.mode, era: `${dotPlatformTx.era}`, }; const { canEditFees, hasFeesProvided, liveTx } = platformAdapter_1.default.getPlatformTransactionSignFlowInfos(dotPlatformTx); expect(canEditFees).toBe(false); expect(hasFeesProvided).toBe(false); expect(liveTx).toEqual(expectedLiveTx); }); }); }); //# sourceMappingURL=platformAdapter.test.js.map