Ver Fonte

LibJS/Tests: Remove 'requires at least one argument' Array tests

These will be removed in favour of just taking the argument and
'risking' a ToObject on null or undefined - this is how the spec does
it.
While that will make the message slightly less specific, it'll bring
the code closer to the spec and reduce complexity, which are both
preferable at the moment.

Doing this is a previous, separate commit is simply an attempt to make
the object rewrite commit smaller.
Linus Groh há 4 anos atrás
pai
commit
4e5362b7cb

+ 0 - 6
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.every.js

@@ -3,12 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].every();
-        }).toThrowWithMessage(TypeError, "Array.prototype.every() requires at least one argument");
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].every(undefined);
             [].every(undefined);

+ 0 - 6
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js

@@ -3,12 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].filter();
-        }).toThrowWithMessage(TypeError, "Array.prototype.filter() requires at least one argument");
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].filter(undefined);
             [].filter(undefined);

+ 0 - 6
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.find.js

@@ -3,12 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].find();
-        }).toThrowWithMessage(TypeError, "Array.prototype.find() requires at least one argument");
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].find(undefined);
             [].find(undefined);

+ 0 - 9
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.findIndex.js

@@ -3,15 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].findIndex();
-        }).toThrowWithMessage(
-            TypeError,
-            "Array.prototype.findIndex() requires at least one argument"
-        );
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].findIndex(undefined);
             [].findIndex(undefined);

+ 0 - 9
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.forEach.js

@@ -3,15 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].forEach();
-        }).toThrowWithMessage(
-            TypeError,
-            "Array.prototype.forEach() requires at least one argument"
-        );
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].forEach(undefined);
             [].forEach(undefined);

+ 0 - 6
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js

@@ -3,12 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].map();
-        }).toThrowWithMessage(TypeError, "Array.prototype.map() requires at least one argument");
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].map(undefined);
             [].map(undefined);

+ 0 - 6
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js

@@ -3,12 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].reduce();
-        }).toThrowWithMessage(TypeError, "Array.prototype.reduce() requires at least one argument");
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].reduce(undefined);
             [].reduce(undefined);

+ 0 - 9
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js

@@ -3,15 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].reduceRight();
-        }).toThrowWithMessage(
-            TypeError,
-            "Array.prototype.reduceRight() requires at least one argument"
-        );
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].reduceRight(undefined);
             [].reduceRight(undefined);

+ 0 - 6
Userland/Libraries/LibJS/Tests/builtins/Array/Array.prototype.some.js

@@ -3,12 +3,6 @@ test("length is 1", () => {
 });
 });
 
 
 describe("errors", () => {
 describe("errors", () => {
-    test("requires at least one argument", () => {
-        expect(() => {
-            [].some();
-        }).toThrowWithMessage(TypeError, "Array.prototype.some() requires at least one argument");
-    });
-
     test("callback must be a function", () => {
     test("callback must be a function", () => {
         expect(() => {
         expect(() => {
             [].some(undefined);
             [].some(undefined);