Name: chai-postman
Owner: Postman
Description: Chai plugin to assert on Postman Collections
Created: 2017-10-11 09:18:06.0
Updated: 2018-05-22 20:52:43.0
Pushed: 2018-05-22 20:52:45.0
Homepage: null
Size: 196
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Chai plugin to assert on Postman Collections
m install chai-postman --save-dev
In order to use this plugin, ensure that you have postman-collection and lodash installed.
_ = require('lodash'),
chai = require('chai'),
sdk = require('postman-collection'),
chaiPostman = require('chai-postman'),
req,
res,
expect = chai.expect;
.use(chaiPostman(sdk, _));
reate postman-collection request and response instances
= new sdk.Request({
header: [{
key: 'Content-Type',
value: 'application/json; charset=utf-8'
}]
= new sdk.Response({ code: 200 });
equest assertions
ct(req).to.be.a.postmanRequest;
ct(req).to.have.header('Content-Type'); // an optional second argument can also be provided to assert value
esponse assertions
ct(res).to.be.a.postmanResponse;
ct(res).to.have.statusCode(200);
Check the tests for a complete reference.
| chai-postman | postman-collection | lodash | |:————:|:——————:|:——-:| | v0.1.0 | v3.x | v4.17.4 | | v1.0.0 | v3.x | v4.17.4 |