@ledgerhq/coin-tron
Version:
Ledger Tron Coin integration
23 lines (17 loc) • 665 B
text/typescript
import type { BlockInfo } from "@ledgerhq/coin-module-framework/api/index";
import { getLastBlock } from "../network";
import { lastBlock } from "./lastBlock";
jest.mock("../network");
describe("lastBlock", () => {
it("should return the last block info", async () => {
const mockBlockInfo: BlockInfo = {
hash: "0000000000000000000a8edc8b8f8b8f8b8f8b8f8b8f8b8f8b8f8b8f8b8f8b8",
height: 123456,
time: new Date(1617181723),
};
(getLastBlock as jest.Mock).mockResolvedValue(mockBlockInfo);
const result = await lastBlock();
expect(result).toEqual(mockBlockInfo);
expect(getLastBlock).toHaveBeenCalledTimes(1);
});
});