jeudi 21 juillet 2016

Why does Jasmine validates against an undefined array to true?

I have an array which has only index 0 and 1 not 2. So zoneB[2] is undefined. But the expect in jasmine does NOT fail with the following expect statement.

expect(zoneB[2].count).toBe(1, "Invalid result for Zone B found");

How can that be? On the other hand the following expect statement is failing.

expect(undefined).toBe(1, "Invalid result for Zone B found");

So where is the difference? How can I come around this without having an extra test on undefined?

Aucun commentaire:

Enregistrer un commentaire