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

LibJS: Add additional Array.prototype.reverse tests

This commit is contained in:
davidot 2021-06-12 23:19:34 +02:00 committed by Linus Groh
parent d723c01af7
commit 516f6240e8

View file

@ -2,8 +2,22 @@ test("length is 0", () => {
expect(Array.prototype.reverse).toHaveLength(0);
});
test("basic functionality", () => {
var array = [1, 2, 3];
expect(array.reverse()).toEqual([3, 2, 1]);
expect(array).toEqual([3, 2, 1]);
describe("basic functionality", () => {
test("Odd length array", () => {
var array = [1, 2, 3];
expect(array.reverse()).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([]);
});
});