Skip to content

Commit 29d8d7e

Browse files
committedNov 2, 2021
release @node-ts/bus-test
1 parent c0b07fc commit 29d8d7e

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed
 

‎packages/bus-test/README.md

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
11
# @node-ts/bus-test
22

3-
This is an unpublished package that's consumed by implementations of `transport` and `persistence` in order to integration test their behaviours and ensure they all do the same thing regardless of the underlying technology.
3+
This package provides a common suite of tests for [@node-ts/bus](https://bus.node-ts.com) that help to ensure consistency across packages that extend the library by adding a new [transport](https://bus.node-ts.com/guide/transports) adapter.
4+
5+
The package expects that [jest](https://www.npmjs.com/package/jest) is used as the test runner.
6+
7+
## Installation
8+
9+
Add this to your transport or persistence package:
10+
11+
```sh
12+
npm i @node-ts/bus-test --save-dev
13+
```
14+
15+
## Implementation
16+
17+
Transport tests are run by creating a `describe()` block and calling `transportTests()` with the following parameters:
18+
19+
- **transport** - A fully configured transport that's the subject under test
20+
- **publishSystemMessage** - A callback that will publish a `@node-ts/bus-test:TestSystemMessage` with a `systemMessage` attribute set to the value of the `testSystemAttributeValue` parameter
21+
- **systemMessageTopicIdentifier** - An optional system message topic identifier that identifies the source topic of the system message
22+
- **readAllFromDeadLetterQueue** - A callback that will read and delete all messages on the dead letter queue
23+
24+
### Example
25+
26+
Examples of how to implement the standard transport tests can be viewed by looking at existing implementations such as:
27+
28+
- [RabbitMqTransport](https://github.com/node-ts/bus/blob/master/packages/bus-rabbitmq/src/rabbitmq-transport.integration.ts)
29+
- [SqsTransport](https://github.com/node-ts/bus/blob/master/packages/bus-sqs/src/sqs-transport.integration.ts)

‎packages/bus-test/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"name": "@node-ts/bus-test",
33
"version": "0.0.8",
4-
"description": "A dev-dependency package used to test transport and persistence implementations.",
4+
"description": "A dev-dependency package used to test transport implementations.",
55
"homepage": "https://github.com/node-ts/bus#readme",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",
88
"license": "MIT",
9-
"private": "true",
109
"repository": "github:node-ts/bus.git",
1110
"scripts": {
1211
"build": "tsc --project tsconfig.json --declaration",

0 commit comments

Comments
 (0)
Please sign in to comment.