chai-postman
Chai plugin to assert on Postman Collections
Install
$ npm install chai-postman --save-dev
Usage
In order to use this plugin, ensure that you have postman-collection
and lodash installed.
var _ = require('lodash'),
chai = require('chai'),
sdk = require('postman-collection'),
chaiPostman = require('chai-postman'),
req,
res,
expect = chai.expect;
chai.use(chaiPostman(sdk, _));
req = new sdk.Request({
header: [{
key: 'Content-Type',
value: 'application/json; charset=utf-8'
}]
});
res = new sdk.Response({ code: 200 });
expect(req).to.be.a.postmanRequest;
expect(req).to.have.header('Content-Type');
expect(res).to.be.a.postmanResponse;
expect(res).to.have.statusCode(200);
Check the tests for a complete reference.
Compatibility
chai-postman | postman-collection | lodash |
---|
v0.1.0 | v3.x | v4.17.4 |
v1.0.0 | v3.x | v4.17.4 |