tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 195 forks source link

.a.lengthOf() error #102

Closed alexwhitman closed 11 years ago

alexwhitman commented 11 years ago

[].should.have.length(0) is fine. [].should.have.lengthOf(0) is fine. [].should.have.a.lengthOf(0) gives:

     TypeError: Object function (type, desc){
    this.assert(
        type == typeof this.obj
      , function(){ return 'expected ' + this.inspect + ' to be a ' + type + (desc ? " | " + desc : "") }
      , function(){ return 'expected ' + this.inspect + ' not to be a ' + type  + (desc ? " | " + desc : "") })
    return this;
  } has no method 'lengthOf'
ifraixedes commented 11 years ago

+1

btd commented 11 years ago

It is because .a it is method to check typeof. It is covered in docs.

ifraixedes commented 11 years ago

That's all right, but then it is needed to remove from README that line which is in "Length" section: https://github.com/visionmedia/should.js#length

btd commented 11 years ago

Yes, you right. I will fix it. I will reopen it for now, I have some idea about a.

btd commented 11 years ago

Fixed in v2.