chai-postman
Advanced tools
Comparing version 1.1.3 to 2.0.0-beta.1
@@ -1,2 +0,2 @@ | ||
var FIRST_LINE = /(.*?)\n.*/g, | ||
const FIRST_LINE = /(.*?)\n.*/g, | ||
@@ -33,3 +33,3 @@ statusClassReasons = { | ||
module.exports = function (sdk, _, Ajv) { | ||
var requestOrResponse = function (what) { | ||
const requestOrResponse = function (what) { | ||
return sdk.Request.isRequest(what) && 'request' || sdk.Response.isResponse(what) && 'response' || undefined; | ||
@@ -69,3 +69,4 @@ }; | ||
var statusClass = Math.floor(this._obj.code / 100); | ||
const statusClass = Math.floor(this._obj.code / 100); | ||
this.assert(statusClass === classCode, | ||
@@ -83,3 +84,4 @@ 'expected response code to be #{exp}XX but found #{act}', | ||
var statusClass = Math.floor(this._obj.code / 100); | ||
const statusClass = Math.floor(this._obj.code / 100); | ||
this.assert(statusClass === classCode, | ||
@@ -97,3 +99,4 @@ 'expected response code to be #{exp}XX but found #{act}', | ||
var statusClass = Math.floor(this._obj.code / 100); | ||
const statusClass = Math.floor(this._obj.code / 100); | ||
this.assert(statusClass === 4 || statusClass === 5, | ||
@@ -137,3 +140,3 @@ 'expected response code to be 4XX or 5XX but found #{act}', | ||
var wantedReason = reason.name.toUpperCase(), | ||
const wantedReason = reason.name.toUpperCase(), | ||
actualReason = String(this._obj.reason()).toUpperCase(), | ||
@@ -159,2 +162,3 @@ actualStatusCode = Number(this._obj.details().code); | ||
'expected #{this} to be falsy'); | ||
return; | ||
@@ -168,3 +172,3 @@ } | ||
var wantedReason = 'OK', | ||
const wantedReason = 'OK', | ||
actualReason = String(this._obj.reason()).toUpperCase(), | ||
@@ -210,3 +214,3 @@ actualStatusCode = Number(this._obj.details().code); | ||
var ror = requestOrResponse(this._obj); | ||
const ror = requestOrResponse(this._obj); | ||
@@ -231,3 +235,3 @@ this.assert(this._obj.headers.has(headerKey), | ||
var bodyText = this._obj.text(); | ||
const bodyText = this._obj.text(); | ||
@@ -259,3 +263,2 @@ this.assert(_.isString(bodyText) && bodyText.length, | ||
'expected response body not to be a valid json'); | ||
}); | ||
@@ -265,2 +268,3 @@ | ||
var bodyData; | ||
new Assertion(this._obj).to.be.postmanResponse; | ||
@@ -293,2 +297,3 @@ | ||
'expected response to not have content in body'); | ||
return; | ||
@@ -303,2 +308,3 @@ } | ||
content, bodyData); | ||
return; | ||
@@ -335,2 +341,3 @@ } | ||
'expected response body not to be a valid json'); | ||
return; | ||
@@ -356,3 +363,3 @@ } | ||
Assertion.addChainableMethod('responseTime', function (value) { | ||
var time = chai.util.flag(this, 'number'); | ||
const time = chai.util.flag(this, 'number'); | ||
@@ -375,3 +382,3 @@ this.assert(_.isNumber(time), | ||
Assertion.addChainableMethod('responseSize', function (value) { | ||
var size = chai.util.flag(this, 'number'); | ||
const size = chai.util.flag(this, 'number'); | ||
@@ -390,3 +397,3 @@ this.assert(_.isNumber(size), | ||
var size = this._obj.size(), | ||
const size = this._obj.size(), | ||
total = (size.header || 0) + (size.body || 0); | ||
@@ -405,2 +412,3 @@ | ||
// eslint-disable-next-line prefer-object-spread | ||
options = Object.assign({ | ||
@@ -407,0 +415,0 @@ allErrors: true, // check all rules collecting all errors |
{ | ||
"name": "chai-postman", | ||
"version": "1.1.3", | ||
"version": "2.0.0-beta.1", | ||
"description": "A Chai plugin for Postman assertions", | ||
"author": "Postman Inc.", | ||
"license": "Apache-2.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node npm/test.js", | ||
"test-lint": "node npm/test-lint.js", | ||
"test-browser": "node npm/test-browser.js", | ||
"test-unit": "node npm/test-unit.js", | ||
"test-system": "node npm/test-system.js" | ||
"homepage": "https://github.com/postmanlabs/chai-postman#readme", | ||
"bugs": { | ||
"url": "https://github.com/postmanlabs/chai-postman/issues", | ||
"email": "help@postman.com" | ||
}, | ||
@@ -19,55 +19,42 @@ "repository": { | ||
"chai", | ||
"postman", | ||
"plugin", | ||
"assertions", | ||
"sandbox", | ||
"runtime" | ||
"chai-plugin", | ||
"postman" | ||
], | ||
"author": "Postman Labs <help@getpostman.com> (=)", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"release": "node npm/create-release.js", | ||
"test": "npm run test-lint && npm run test-system && npm run test-unit && npm run test-browser", | ||
"test-browser": "node npm/test-browser.js", | ||
"test-lint": "node npm/test-lint.js", | ||
"test-system": "node npm/test-system.js", | ||
"test-unit": "nyc --nycrc-path=.nycrc.js node npm/test-unit.js" | ||
}, | ||
"devDependencies": { | ||
"ajv": "6.10.2", | ||
"async": "2.6.1", | ||
"browserify": "16.3.0", | ||
"chai": "4.2.0", | ||
"chalk": "2.4.2", | ||
"dependency-check": "4.1.0", | ||
"editorconfig": "0.15.3", | ||
"eslint": "5.15.3", | ||
"eslint-plugin-jsdoc": "4.6.0", | ||
"eslint-plugin-lodash": "5.1.0", | ||
"eslint-plugin-mocha": "6.0.0", | ||
"eslint-plugin-security": "1.4.0", | ||
"js-yaml": "3.13.1", | ||
"jsdoc": "3.6.3", | ||
"jsdoc-to-markdown": "5.0.0", | ||
"karma": "3.1.4", | ||
"karma-browserify": "5.3.0", | ||
"karma-chrome-launcher": "3.0.0", | ||
"karma-mocha": "1.3.0", | ||
"karma-mocha-reporter": "2.2.5", | ||
"lodash": "4.17.15", | ||
"mocha": "6.2.0", | ||
"nyc": "13.3.0", | ||
"parse-gitignore": "1.0.1", | ||
"postman-collection": "3.5.1", | ||
"pretty-ms": "5.0.0", | ||
"puppeteer": "1.19.0", | ||
"recursive-readdir": "2.2.2", | ||
"shelljs": "0.8.3", | ||
"watchify": "3.11.1", | ||
"yankee": "1.0.8" | ||
"@postman/shipit": "0.2.0", | ||
"ajv": "^6.12.5", | ||
"browserify": "^16.5.2", | ||
"chai": "^4.2.0", | ||
"chalk": "^4.1.0", | ||
"editorconfig": "^0.15.3", | ||
"eslint": "^7.10.0", | ||
"eslint-plugin-jsdoc": "^30.6.3", | ||
"eslint-plugin-lodash": "^7.1.0", | ||
"eslint-plugin-mocha": "^8.0.0", | ||
"eslint-plugin-security": "^1.4.0", | ||
"js-yaml": "^3.14.0", | ||
"karma": "^5.2.3", | ||
"karma-browserify": "^7.0.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-mocha": "^2.0.1", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"lodash": "^4.17.20", | ||
"mocha": "^8.1.3", | ||
"nyc": "^15.1.0", | ||
"parse-gitignore": "^1.0.1", | ||
"postman-collection": "^3.6.7", | ||
"recursive-readdir": "^2.2.2", | ||
"watchify": "^3.11.1" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/postmanlabs/chai-postman/issues" | ||
}, | ||
"homepage": "https://github.com/postmanlabs/chai-postman#readme", | ||
"greenkeeper": { | ||
"ignore": [ | ||
"eslint-plugin-jsdoc" | ||
] | ||
"node": ">=10" | ||
} | ||
} |
@@ -1,4 +0,3 @@ | ||
# chai-postman | ||
# chai-postman [![Build Status](https://travis-ci.com/postmanlabs/chai-postman.svg?branch=develop)](https://travis-ci.com/postmanlabs/chai-postman) [![codecov](https://codecov.io/gh/postmanlabs/chai-postman/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/chai-postman) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/postmanlabs/chai-postman.svg)](https://greenkeeper.io/) | ||
[Chai plugin](http://chaijs.com/api/plugins/) to assert on Postman Collections | ||
@@ -46,8 +45,1 @@ | ||
Check the [tests](https://github.com/postmanlabs/chai-postman/tree/develop/test/unit) 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 | |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24
34635
6
347
1
45