@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
46 lines • 2.02 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const bignumber_js_1 = __importDefault(require("bignumber.js"));
const live_app_sdk_1 = require("@ledgerhq/live-app-sdk");
const platformAdapter_1 = __importDefault(require("./platformAdapter"));
describe("getPlatformTransactionSignFlowInfos", () => {
describe("should properly get infos for XRP platform tx", () => {
it("without fees provided", () => {
const xrpPlatformTx = {
family: live_app_sdk_1.FAMILIES.RIPPLE,
amount: new bignumber_js_1.default(100000),
recipient: "0xABCDEF",
tag: 1,
};
const expectedLiveTx = {
...xrpPlatformTx,
family: "xrp",
};
const { canEditFees, hasFeesProvided, liveTx } = platformAdapter_1.default.getPlatformTransactionSignFlowInfos(xrpPlatformTx);
expect(canEditFees).toBe(true);
expect(hasFeesProvided).toBe(false);
expect(liveTx).toEqual(expectedLiveTx);
});
it("with fees provided", () => {
const xrpPlatformTx = {
family: live_app_sdk_1.FAMILIES.RIPPLE,
amount: new bignumber_js_1.default(100000),
recipient: "0xABCDEF",
fee: new bignumber_js_1.default(300),
tag: 1,
};
const expectedLiveTx = {
...xrpPlatformTx,
family: "xrp",
};
const { canEditFees, hasFeesProvided, liveTx } = platformAdapter_1.default.getPlatformTransactionSignFlowInfos(xrpPlatformTx);
expect(canEditFees).toBe(true);
expect(hasFeesProvided).toBe(true);
expect(liveTx).toEqual(expectedLiveTx);
});
});
});
//# sourceMappingURL=platformAdapter.test.js.map