kwest-mock

0.2.1 • Public • Published

kwest-mock Dependency Status

Provides mock kwest-base object for plugin testing.

Installation

$ npm install --save-dev kwest-mock

Use

Example with mocha

var mock = require('kwest-mock');
var assert = require('chai').assert;
 
var request = mock(function(request, respond) {
  assert.strictEqual(request.getHeader('x-test'), 'success');
  return respond({
    headers: {
      'x-test': 'success'
    }
  });
});
 
describe('mock', function () {
  it('should work', function (done) {
    request('http://www.example.com').then(function (response) {
      assert.strictEqual(response.getHeader('x-test'), 'success');
      done();
    })
    .catch(done);
  });
});
 

Readme

Keywords

Package Sidebar

Install

npm i kwest-mock

Weekly Downloads

0

Version

0.2.1

License

MIT

Last publish

Collaborators

  • janpotoms