0.27.0 • Published 6 years ago

exocom-mock v0.27.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Mock implementation of ExoCom in JavaScript

Dependency Status devDependency Status

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

Installation

$ npm i --save-dev exocom-mock

Usage

  • create an instance

    ExoComMock = require('exocom-mock')
    exocom = new ExoComMock
  • register a service to send messages to

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

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

    # ... make your service sent out a request here via exocom.sendMessage...
    
    # wait for the message to arrive
    exocom.waitUntilReceive =>
    
      # verify the received message
      expect(exocom.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

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

    exocom.close()

Development

See our developer documentation

0.27.0

6 years ago

0.26.4

7 years ago

0.26.3

7 years ago

0.26.2

7 years ago

0.26.1

7 years ago

0.26.0

7 years ago

0.25.1

7 years ago

0.24.0

7 years ago

0.23.0

7 years ago

0.22.1

7 years ago

0.22.0

7 years ago

0.21.8

7 years ago

0.21.7

7 years ago

0.21.5

7 years ago

0.21.4

7 years ago

0.21.3

7 years ago

0.21.2

7 years ago

0.21.1

7 years ago

0.21.0

7 years ago

0.10.0

7 years ago

0.9.4

7 years ago

0.9.3

7 years ago

0.9.2

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago

0.8.1

8 years ago

0.8.0

8 years ago

0.7.0

8 years ago

0.6.0

8 years ago