🔢
toBeNaN
Determine if your number is not a number
As the joke goes...
1
typeof NaN === "number"
Copied!
... as in, the NaN float value is considered a number. However, toBe assertions will fail if you try to expect some value toBe(NaN) . This assertion will provide proof that your actual value is, in fact, a NaN value.
1
expect(NaN).toBeNaN(); // passes
2
expect(1.0).not.toBeNaN(); // passes
3
4
// compile time error, will be reported when the suite is run
5
expect(new Vec3()).not.toBeNaN();
Copied!
If this method is called with anything other than a f32 | f64 type, it will result in a compile time error.
This method is safe to use with jest portably.
Last modified 1yr ago
Copy link