americanexpress/parrot

Enable websocket scenarios

Opened this issue · 2 comments

I want to add parrot-websockets so that developers can mock scenarios using WebSockets.

Usage

// scenarios.js

module.exports.httpScenarios = { ... };

module.exports.wssScenarios = {
  'some websocket': [
    {
      on: 'message',
      emmit: {
        event: 'message',
        args: {
          foo: 'foo',
          bar: 'bar',
        },
      },
    },
  ],
};
// dev.middleware.js

const parrot = require('parrot-middleware');
const parrotWs = require('parrot-websockets');
const { httpScenarios, wssScenarios } = require('./mock/scenarios');

module.exports = (app) => {
  app.use(parrot(httpScenarios));
  app.use(parrotWs(wssScenarios));
};

This would be a fantastic addition!

This issue is stale because it has been open 30 days with no activity. Remove no-issue-activity label or comment or this will be closed in 5 days.