0.6.0 • Published 9 years ago

exocomm-mock v0.6.0

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

Mock implementation of ExoComm in JavaScript

Circle CI

a mock implementation of ExoComm-Dev for sending and receiving messages to your ExoServices in test

Installation

$ npm i --save-dev exocomm-mock

Usage

  • create an instance

    ExoCommMock = require('exocomm-mock')
    exocomm = new ExoCommMock
  • register a service to send messages to

    exocomm.registerService name: 'users', port: 4001
  • send a message to the service

    exocomm.sendMessage service: 'users', name: 'users.create', payload: { name: 'Jean-Luc Picard' }
  • verifying messages sent out by the service under test

    # ... make your service sent out a request here via exocomm.sendMessage...
    
    # wait for the message to arrive
    exocomm.waitUntilReceive =>
    
      # verify the received message
      expect(exocomm.receivedMessages()).to.eql [
        {
          name: 'users.created'
          payload:
            name: 'Jean-Luc Picard'
        }
      ]
  • if you want to verify more received messages later, you can reset the register of received messages so far

    exocomm.reset()
  • finally, close your instance when you are done, so that you can create a fresh one for your next test

    exocomm.close()

Development

See our developer documentation

0.6.0

9 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago