dimanche 29 mai 2016

How to test if something is a function with Chai.should

I want to check if something is a function with Chai.should. So I did

typeof(barfoo).should.equals('function')

DEMO

This results in

AssertionError: expected [Function] to equal 'function'
    at Context.<anonymous> (:73:31)

Can someone explain to me why this doesn't work, because if I simply do

typeof(barfoo)

I get a string function. Although I've solved this now with instanceOf but I really want to understand this

Aucun commentaire:

Enregistrer un commentaire