mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
LibJS: Add additional Array.prototype.reverse tests
This commit is contained in:
parent
d723c01af7
commit
516f6240e8
1 changed files with 18 additions and 4 deletions
|
@ -2,8 +2,22 @@ test("length is 0", () => {
|
||||||
expect(Array.prototype.reverse).toHaveLength(0);
|
expect(Array.prototype.reverse).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("basic functionality", () => {
|
describe("basic functionality", () => {
|
||||||
|
test("Odd length array", () => {
|
||||||
var array = [1, 2, 3];
|
var array = [1, 2, 3];
|
||||||
expect(array.reverse()).toEqual([3, 2, 1]);
|
expect(array.reverse()).toEqual([3, 2, 1]);
|
||||||
expect(array).toEqual([3, 2, 1]);
|
expect(array).toEqual([3, 2, 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Even length array", () => {
|
||||||
|
var array = [1, 2];
|
||||||
|
expect(array.reverse()).toEqual([2, 1]);
|
||||||
|
expect(array).toEqual([2, 1]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Empty array", () => {
|
||||||
|
var array = [];
|
||||||
|
expect(array.reverse()).toEqual([]);
|
||||||
|
expect(array).toEqual([]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue