tj / should.js

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

Would make sense for should.have.keys() to cast integer arguments to strings before comparing #208

Closed DanielSmedegaardBuus closed 10 years ago

DanielSmedegaardBuus commented 10 years ago

Hi :)

Since keys on an object have to be strings, IMHO I think it might make sense for should to cast integers before trying to compare. As it stands now, it gives AssertionError if you don't cast them yourself. E.g., I have to do:

game.statuses.should.be.an.Object.and.have.keys(''+match1.id, ''+match3._id);

to not get

Uncaught AssertionError: expected { '1': 'cancelled', '3': 'deleted' } to have keys 1, 3
    extra keys: '1', '3'
btd commented 10 years ago

Yep, i will add it.

DanielSmedegaardBuus commented 10 years ago

Cool, thanks! :)

On Wed, May 28, 2014 at 1:31 PM, Denis Bardadym notifications@github.comwrote:

Yep, i will add it.

— Reply to this email directly or view it on GitHubhttps://github.com/visionmedia/should.js/issues/208#issuecomment-44394926 .

btd commented 10 years ago

I will close this as it already in master (will publish today or at weekend). If you have issues about it, pls create new one in shouldjs/should.js.