mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-08 12:12:53 +00:00
https://tc39.es/ecma262/#sec-properties-of-the-array-prototype-object The Array prototype object: [...] is an Array exotic object and has the internal methods specified for such objects. NOTE: The Array prototype object is specified to be an Array exotic object to ensure compatibility with ECMAScript code that was created prior to the ECMAScript 2015 specification.
25 lines
947 B
JavaScript
25 lines
947 B
JavaScript
test("length is 1", () => {
|
|
expect(Array.isArray).toHaveLength(1);
|
|
});
|
|
|
|
test("arguments that evaluate to false", () => {
|
|
expect(Array.isArray()).toBeFalse();
|
|
expect(Array.isArray("1")).toBeFalse();
|
|
expect(Array.isArray("foo")).toBeFalse();
|
|
expect(Array.isArray(1)).toBeFalse();
|
|
expect(Array.isArray(1, 2, 3)).toBeFalse();
|
|
expect(Array.isArray(undefined)).toBeFalse();
|
|
expect(Array.isArray(null)).toBeFalse();
|
|
expect(Array.isArray(Infinity)).toBeFalse();
|
|
expect(Array.isArray({})).toBeFalse();
|
|
});
|
|
|
|
test("arguments that evaluate to true", () => {
|
|
expect(Array.isArray([])).toBeTrue();
|
|
expect(Array.isArray([1])).toBeTrue();
|
|
expect(Array.isArray([1, 2, 3])).toBeTrue();
|
|
expect(Array.isArray(new Array())).toBeTrue();
|
|
expect(Array.isArray(new Array(10))).toBeTrue();
|
|
expect(Array.isArray(new Array("a", "b", "c"))).toBeTrue();
|
|
expect(Array.isArray(Array.prototype)).toBeTrue();
|
|
});
|