1

I do not understand why the following test is failing with the error:

TypeError: (intermediate value).should.be.type is not a function

describe('#Option object', function() {
    it('returns value as whatever type was passed to the constructor', function() {
        var o = function() {
            this.getValue = function() {
                return new Date();
            }
        };

        var i = new o();
        i.getValue().should.be.type('Date');
    })
});

I've read [most] of the Should.js documentation but I must be missing something. Can anyone tell me what is wrong with my test?

scubasteve
  • 2,718
  • 4
  • 38
  • 49

1 Answers1

1

Actually only one thing wrong. You read not should.js docs, but unit.js docs - it is not related to should.js at all. Correct link. Correct code will be:

i.getValue().should.be.instanceOf(Date);

or

i.getValue().should.be.Date();
den bardadym
  • 2,747
  • 3
  • 25
  • 27