Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hemerajs/hemera-testsuite
Helper library to write tests for Hemera.
https://github.com/hemerajs/hemera-testsuite
hemera testing
Last synced: 2 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-31T08:50:22.000Z (over 6 years ago)
- Last Synced: 2024-10-31T18:09:51.062Z (3 months ago)
- Topics: hemera, testing
- Language: JavaScript
- Homepage:
- Size: 168 KB
- Stars: 2
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/v/hemera-testsuite.svg?maxAge=3600)](https://github.com/hemerajs/hemera-testsuite)
[![Build Status](https://travis-ci.org/hemerajs/hemera-testsuite.svg?branch=master)](https://travis-ci.org/hemerajs/hemera-testsuite)
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/hemerajs/hemera)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](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.