Filip Zawada

👨🏻‍💻 iOS tinkerer

Jasmine: Test object’s type

Jasmine: test instance type with jasmine.any()

While working on Fingers.js I needed to test a type of a certain value. It appears, that there’s a dedicated jasmine.any() matcher for this in Jasmine 2.0. Let’s see how it works:

Jasmine: toEqual vs toBe

Another observation is that jasmine.any() doesn’t work with .toBe() matcher (instead of toEqual). This is because .toEqual() compares objects values, while .toBe() checks for strict equality (===).

Consider following case:

Leave a Reply

Blue Captcha Image