Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

exocom-mock

Package Overview
Dependencies
Maintainers
4
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exocom-mock

A mock implementation of the ExoCom development server in JavaScript, for testing

  • 0.27.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

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

FAQs

Package last updated on 09 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc