postmanlabs/chai-postman

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

chai-postman

Greenkeeper badge Chai plugin to assert on Postman Collections

Install
m install chai-postman --save-dev
Usage

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.

Compatibility

| chai-postman | postman-collection | lodash | |:————:|:——————:|:——-:| | v0.1.0 | v3.x | v4.17.4 | | v1.0.0 | v3.x | v4.17.4 |


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.