Closed weepy closed 11 years ago
All - just found you can do: should.ok(null)
Perhaps we could rename the library to is
, which works for both calling methods:
x.is.within(5) is.ok(5)
!!!
I like the should.be.ok
idea, but in general, I've been longing for the word "exist" instead of "ok". I've forked this and am in the middle of implementing should.exist()
as an alias for should.ok()
. What do you guys think?
Here's my implementation: https://github.com/visionmedia/should.js/pull/11
(It would be nice if you could import a pull request into an existing issue.)
TJ just pulled my change -- thanks! You can now do:
should.exist(foo); // will throw if null or undefined
foo.should.equal(bar); // safe assertion to make now
I can't close this issue so someone else may want to.
i suppose there's probably not much we can do here , but it's a shame we can't handle null :
null.should.not.be.ok
results in "Cannot read property 'should' of null"
i was wondering if we could support some kind of alternate calling scheme where the should comes first :
should.be.ok(null)