UNPKG

@hashgraph/hedera-cli

Version:

CLI tool to manage and setup developer environments for Hedera Hashgraph.

32 lines (26 loc) 849 B
import { TopicMessageSubmitTransaction } from '@hashgraph/sdk'; let customMockImplementation: (() => TopicMessageSubmitTransaction) | null = null; export const setCustomMockImplementation = ( customImpl: (() => TopicMessageSubmitTransaction) | null, ) => { customMockImplementation = customImpl; }; const defaultMockImplementation = () => ({ freezeWith: jest.fn().mockReturnThis(), execute: jest.fn().mockResolvedValue({ getReceipt: jest.fn().mockResolvedValue({ topicSequenceNumber: 1, }), }), }) as unknown as TopicMessageSubmitTransaction; const mockTopicMessageSubmitTransaction = () => customMockImplementation ? customMockImplementation() : defaultMockImplementation(); const sdkMock = { setCustomMockImplementation, mockTopicMessageSubmitTransaction, } export default sdkMock;