UNPKG

@ledgerhq/coin-ton

Version:
77 lines 3.52 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); const api_1 = require("../../bridge/bridgeHelpers/api"); const config_1 = require("../../config"); const api_fixtures_1 = __importStar(require("../fixtures/api.fixtures")); const common_fixtures_1 = require("../fixtures/common.fixtures"); describe("getAccount", () => { beforeAll(() => { (0, config_1.setCoinConfig)(() => ({ status: { type: "active", }, infra: { API_TON_ENDPOINT: api_fixtures_1.API_TON_ENDPOINT, KNOWN_JETTONS: [], }, })); api_fixtures_1.default.listen(); }); afterAll(() => { api_fixtures_1.default.close(); }); it("should return last block number", async () => { const result = await (0, api_1.fetchLastBlockNumber)(); expect(result).toEqual(common_fixtures_1.lastBlockNumber.last.seqno); }); it("should return the transactions of an address", async () => { const result = await (0, api_1.fetchTransactions)(common_fixtures_1.mockAddress); expect(result).toEqual(common_fixtures_1.tonTransactionResponse); }); it("should return the ton account info of an address", async () => { const result = await (0, api_1.fetchAccountInfo)(common_fixtures_1.mockAddress); expect(result).toEqual({ balance: common_fixtures_1.tonAccount.balance, last_transaction_lt: common_fixtures_1.tonAccount.last_transaction_lt, last_transaction_hash: common_fixtures_1.tonAccount.last_transaction_hash, status: common_fixtures_1.tonAccount.status, seqno: common_fixtures_1.tonWallet.seqno, }); }); it("should return the jetton transactions", async () => { const result = await (0, api_1.fetchJettonTransactions)(common_fixtures_1.mockAddress); expect(result).toEqual(common_fixtures_1.jettonTransferResponse.jetton_transfers); }); it("should return the jetton wallets", async () => { const result = await (0, api_1.fetchJettonWallets)(); expect(result).toEqual(common_fixtures_1.jettonWallets.jetton_wallets); }); it("should return the estimated fees", async () => { const result = await (0, api_1.estimateFee)(common_fixtures_1.mockAddress, ""); expect(result).toEqual(common_fixtures_1.tonEstimateFee.source_fees); }); }); //# sourceMappingURL=api.unit.test.js.map