UNPKG

@ledgerhq/coin-canton

Version:
35 lines 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const broadcast_1 = require("./broadcast"); jest.mock("@ledgerhq/coin-framework/operation"); jest.mock("../common-logic"); const operation_1 = require("@ledgerhq/coin-framework/operation"); const common_logic_1 = require("../common-logic"); describe("broadcast", () => { let patchOperationSpy; let broadcastSpy; beforeEach(() => { patchOperationSpy = jest.spyOn({ patchOperationWithHash: operation_1.patchOperationWithHash }, "patchOperationWithHash"); broadcastSpy = jest.spyOn({ broadcastLogic: common_logic_1.broadcast }, "broadcastLogic"); broadcastSpy.mockResolvedValue("hash"); }); it("should broadcast", () => { (0, broadcast_1.broadcast)({ signedOperation: { signature: undefined, operation: undefined, }, }); expect(common_logic_1.broadcast).toHaveBeenCalledTimes(1); }); it("should patch operation with hash", () => { (0, broadcast_1.broadcast)({ signedOperation: { signature: undefined, operation: undefined, }, }); expect(patchOperationSpy).toHaveBeenCalledWith(undefined, "hash"); }); }); //# sourceMappingURL=broadcast.test.js.map