https://github.com/hemerajs/hemera-testsuite
Helper library to write tests for Hemera.
https://github.com/hemerajs/hemera-testsuite
hemera testing
Last synced: 3 months ago
JSON representation
Helper library to write tests for Hemera.
- Host: GitHub
- URL: https://github.com/hemerajs/hemera-testsuite
- Owner: hemerajs
- License: mit
- Created: 2016-12-04T01:50:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-31T08:50:22.000Z (about 7 years ago)
- Last Synced: 2025-04-12T02:32:06.775Z (3 months ago)
- Topics: hemera, testing
- Language: JavaScript
- Homepage:
- Size: 168 KB
- Stars: 2
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/hemerajs/hemera-testsuite)
[](https://travis-ci.org/hemerajs/hemera-testsuite)
[](https://gitter.im/hemerajs/hemera)
[](http://standardjs.com)# hemera-testsuite
Helper library to write tests against NATS.## Use cases
- You want to create an integration test (cluster support)
- You want to run in-memory tests## Prerequisites
[Install](https://nats.io/documentation/tutorials/gnatsd-install/) NATS Server and include the path to the executable in your user `PATH` environment variable. (Only needed for integration tests)
## Installing
```
npm i hemera-testsuite
```## Emulate NATS
We emulate all core features of NATS server. You can run and test your service in memory.### Features
- Support of wildcard `*` and `>` subjects
- Support for maxMessages$, expectedMessages$ options
- Support for request & publish
- Support for timeouts### Not supported*
- Custom queue groups
- Special one-to-one publish
- Load balancing
- Connection related states\**In this case we recommend to start a real NATS Server.*
```js
const Hemera = require('nats-hemera')
const Nats = require('hemera-testsuite/nats')
const nats = new Nats()
const hemera = new Hemera(nats, {
logLevel: 'info'
})
```## Full Integration test
- Run your tests against a real NATS server
[Example](https://github.com/hemerajs/hemera/blob/master/test/hemera/index.spec.js)
## Credits
Thanks to [node-nats](https://github.com/nats-io/node-nats) for providing the script to bootstrap the server.