kwest-mock
v0.2.1
Published
Provides mock kwest object for plugin testing.
Downloads
9
Readme
kwest-mock
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);
});
});