summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/builtins/functions/isNaN.js
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Tests/builtins/functions/isNaN.js')
-rw-r--r--Libraries/LibJS/Tests/builtins/functions/isNaN.js46
1 files changed, 20 insertions, 26 deletions
diff --git a/Libraries/LibJS/Tests/builtins/functions/isNaN.js b/Libraries/LibJS/Tests/builtins/functions/isNaN.js
index 7519b68fd2..188050ef6e 100644
--- a/Libraries/LibJS/Tests/builtins/functions/isNaN.js
+++ b/Libraries/LibJS/Tests/builtins/functions/isNaN.js
@@ -1,28 +1,22 @@
-load("test-common.js");
+test("basic functionality", () => {
+ expect(isNaN).toHaveLength(1);
-try {
- assert(isNaN.length === 1);
+ expect(isNaN(0)).toBeFalse();
+ expect(isNaN(42)).toBeFalse();
+ expect(isNaN("")).toBeFalse();
+ expect(isNaN("0")).toBeFalse();
+ expect(isNaN("42")).toBeFalse();
+ expect(isNaN(true)).toBeFalse();
+ expect(isNaN(false)).toBeFalse();
+ expect(isNaN(null)).toBeFalse();
+ expect(isNaN([])).toBeFalse();
+ expect(isNaN(Infinity)).toBeFalse();
+ expect(isNaN(-Infinity)).toBeFalse();
- assert(isNaN(0) === false);
- assert(isNaN(42) === false);
- assert(isNaN("") === false);
- assert(isNaN("0") === false);
- assert(isNaN("42") === false);
- assert(isNaN(true) === false);
- assert(isNaN(false) === false);
- assert(isNaN(null) === false);
- assert(isNaN([]) === false);
- assert(isNaN(Infinity) === false);
- assert(isNaN(-Infinity) === false);
-
- assert(isNaN() === true);
- assert(isNaN(NaN) === true);
- assert(isNaN(undefined) === true);
- assert(isNaN("foo") === true);
- assert(isNaN({}) === true);
- assert(isNaN([1, 2, 3]) === true);
-
- console.log("PASS");
-} catch (e) {
- console.log("FAIL: " + e.message);
-}
+ expect(isNaN()).toBeTrue();
+ expect(isNaN(NaN)).toBeTrue();
+ expect(isNaN(undefined)).toBeTrue();
+ expect(isNaN("foo")).toBeTrue();
+ expect(isNaN({})).toBeTrue();
+ expect(isNaN([1, 2, 3])).toBeTrue();
+});