Closed ghost closed 12 years ago
haha yeah that's a big no unfortunately, for null or undefined checks I usually use node's assert since you can just do assert(!err)
etc
I struggled to write the should
statement for undefined tests. The following doesn't work.
target.should.be.undefined();
I found the following solutions.
(target === undefined).should.be.true()
if can also write it as a type check
(typeof target).should.be.equal('undefined');
Not sure if the above is the right way, but it does work.
You can use this:
should(target).not.be.ok;
Or this:
should.not.exist(target)
Right now I am using should.equal null and should.equal undefined.
Would it be better if you could use these assertions directly?
UPDATE: I just realized that you cannot have methods to null and undefined :)