@amqp-contract/testing / extension
extension
Vitest extension module for AMQP testing utilities
This module provides a Vitest test extension that adds AMQP-specific fixtures to your tests. Each test gets an isolated virtual host (vhost) with pre-configured connections, channels, and helper functions for publishing and consuming messages.
Type Aliases
AmqpTestFixtures
ts
type AmqpTestFixtures = object;Defined in: extension.ts:33
The AMQP test fixtures provided by the it extension — named so helpers accepting fixture values (amqpChannel, publishMessage, …) can be typed without re-deriving the record from it.
Properties
| Property | Type | Defined in |
|---|---|---|
amqpChannel | Channel | extension.ts:37 |
amqpConnection | ChannelModel | extension.ts:36 |
amqpConnectionUrl | string | extension.ts:35 |
initConsumer | (exchange, routingKey) => Promise<(options?) => Promise<amqpLib.ConsumeMessage[]>> | extension.ts:43 |
publishMessage | (target, content, options?) => void | extension.ts:38 |
vhost | string | extension.ts:34 |
WaitForMessagesOptions
ts
type WaitForMessagesOptions = object;Defined in: extension.ts:21
Options for the message-wait function returned by the initConsumer fixture.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
count? | number | Number of messages to wait for. Defaults to 1. | extension.ts:23 |
timeoutMs? | number | Maximum time in ms to wait before rejecting. Defaults to 5000. | extension.ts:25 |
Variables
it
ts
const it: TestAPI<{
amqpChannel: Channel;
amqpConnection: ChannelModel;
amqpConnectionUrl: string;
initConsumer: (exchange, routingKey) => Promise<(options?) => Promise<ConsumeMessage[]>>;
publishMessage: (target, content, options?) => void;
vhost: string;
}>;Defined in: extension.ts:49