@onichandame/mock-nats-client

A mocked NATS client for unit test. All messaging actions are carried out in memory only.

Usage no npm install needed!

<script type="module">
  import onichandameMockNatsClient from 'https://cdn.skypack.dev/@onichandame/mock-nats-client';
</script>

README

Mock NATS Client

A mocked NATS client for unit test. All messaging actions are carried out in memory only.

Has the same function signature and typing with the original ts-nats library.

Author

onichandame

Usage

Installation

yarn add @onichandame/mock-nats-client

Connection

import { connect } from '@onichandame/mock-nats-client'

const nc = await connect()

Subscribe:

nc.subscribe('subject', (e, msg) => console.log(msg.data))

Publish:

nc.publish('subscribe', {})

Any feature request or bug report is welcome.