Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

should

Package Overview
Dependencies
Maintainers
0
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

should - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

6

History.md
0.2.0 / 2011-04-17
==================
* Added `res.should.have.status(code)` method
* Added `res.should.have.header(field, val)` method
0.1.0 / 2011-04-06

@@ -3,0 +9,0 @@ ==================

38

lib/should.js

@@ -34,3 +34,3 @@

exports.version = '0.1.0';
exports.version = '0.2.0';

@@ -569,2 +569,38 @@ /**

return this;
},
/**
* Assert that header `field` has the given `val`.
*
* @param {String} field
* @param {String} val
* @return {Assertion} for chaining
* @api public
*/
header: function(field, val){
this.obj.should.have.property('headers');
this.obj.headers.should.have.property(field.toLowerCase(), val);
return this;
},
/**
* Assert `.statusCode` of `code`.
*
* @param {Number} code
* @return {Assertion} for chaining
* @api public
*/
status: function(code){
this.obj.should.have.property('statusCode');
var status = this.obj.statusCode;
this.assert(
code == status
, 'expected response code of ' + code + ' ' + i(statusCodes[code])
+ ', but got ' + status + ' ' + i(statusCodes[status])
, 'expected to not respond with ' + code + ' ' + i(statusCodes[code]));
return this;
}

@@ -571,0 +607,0 @@ };

2

package.json
{ "name": "should"
, "description": "test framework agnostic BDD-style assertions"
, "version": "0.1.0"
, "version": "0.2.0"
, "author": "TJ Holowaychuk <tj@vision-media.ca>"

@@ -5,0 +5,0 @@ , "contributors": [ "Aseem Kishore <aseem.kishore@gmail.com>" ]

@@ -27,2 +27,18 @@ _should_ is an expressive, readable, test framework agnostic, assertion library for [node](http://nodejs.org).

## assert extras
As mentioned above, _should_ extends node's _assert_. The returned object from `require('should')` is thus similar to the returned object from `require('assert')`, but it has one extra convenience method:
should.exist('hello')
should.exist([])
should.exist(null) // will throw
This is equivalent to `should.ok`, which is equivalent to `assert.ok`, but reads a bit better. It gets better, though:
should.not.exist(false)
should.not.exist('')
should.not.exist({}) // will throw
We may add more _assert_ extras in the future... ;)
## modifiers

@@ -29,0 +45,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc