Question

According to should.js Spec this should work:

should.strictEqual(shape.code, code)

but I get:

TypeError: Object #<Object> has no method 'strictEqual'

What am I missing?

Was it helpful?

Solution

Looks like an error in the documentation. equal is defined in the script as "strict equal":

/**
 * Assert strict equal.
 *
 * @param {Mixed} val
 * @param {String} description
 * @api public
 */

equal: function(val, desc){
  this.assert(
      val.valueOf() === this.obj
    , 'expected ' + this.inspect + ' to equal ' + i(val) + (desc ? " | " + desc : "")
    , 'expected ' + this.inspect + ' to not equal ' + i(val) + (desc ? " | " + desc : "")
    , val);
  return this;
},

...and strictEqual does not appear in the script.

OTHER TIPS

Should.js offers .equal() to check for identity (===), and .eql() to check for equality (==).

Reference: https://github.com/visionmedia/should.js/blob/9feffef939197002ce16708c27036f7f744e8131/lib/should.js#L277-L309

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top