Skip to main content

Module mock

Module mock 

Source
Expand description

Mock implementation that combines both publish/subscribe and request/response patterns for unit testing without a NATS server.

ModulesΒ§

command πŸ”’
Mock implementations of Requester and Responder for unit testing without a NATS server.
event πŸ”’
Mock implementations of Publisher and Subscriber for unit testing without a NATS server.

StructsΒ§

MockBus
Combined in-memory message bus for unit tests.
MockPublisher
In-memory Publisher for use in unit tests.
MockReceivedCommand
Mock implementation of ReceivedCommand for unit tests.
MockReceivedEvent
A received event wrapper for use in unit tests.
MockSubscriber
Helper for creating test event streams.
ReplyChecker
Receives the reply captured by a MockReceivedCommand.

Type AliasesΒ§

MockCommandPayload πŸ”’
A received command’s payload paired with the channel its reply must be sent back on.
MockPublishedMessages πŸ”’
A List of messages represented as a tuple of an identifier and the bytes.
MockResponderHashMap πŸ”’
A map of command responders grouped by the command subject pattern they serve.
MockSenderHashMap πŸ”’
A map of senders grouped by the emitting type of the sender.