1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

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.
This commit is contained in:
Linus Groh 2021-07-04 18:12:00 +01:00
parent 777a93918f
commit 4e5362b7cb
9 changed files with 0 additions and 63 deletions

View file

@ -3,12 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].every(undefined);

View file

@ -3,12 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].filter(undefined);

View file

@ -3,12 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].find(undefined);

View file

@ -3,15 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].findIndex(undefined);

View file

@ -3,15 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].forEach(undefined);

View file

@ -3,12 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].map(undefined);

View file

@ -3,12 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].reduce(undefined);

View file

@ -3,15 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].reduceRight(undefined);

View file

@ -3,12 +3,6 @@ test("length is 1", () => {
});
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", () => {
expect(() => {
[].some(undefined);