2

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?

Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746

2 Answers2

2

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.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
1

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

vlad
  • 497
  • 4
  • 6