mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 18:17:23 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
50
Libraries/LibJS/Tests/builtins/Reflect/Reflect.ownKeys.js
Normal file
50
Libraries/LibJS/Tests/builtins/Reflect/Reflect.ownKeys.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
test("length is 1", () => {
|
||||
expect(Reflect.ownKeys).toHaveLength(1);
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("target must be an object", () => {
|
||||
[null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
|
||||
expect(() => {
|
||||
Reflect.ownKeys(value);
|
||||
}).toThrowWithMessage(TypeError, `${value} is not an object`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("normal behavior", () => {
|
||||
test("regular empty object has no own keys", () => {
|
||||
var objectOwnKeys = Reflect.ownKeys({});
|
||||
expect(objectOwnKeys instanceof Array).toBeTrue();
|
||||
expect(objectOwnKeys).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("regular object with some properties has own keys", () => {
|
||||
var symbol = Symbol("symbol");
|
||||
var objectOwnKeys = Reflect.ownKeys({ foo: "bar", [symbol]: "qux", bar: "baz", 0: 42 });
|
||||
expect(objectOwnKeys instanceof Array).toBeTrue();
|
||||
expect(objectOwnKeys).toHaveLength(4);
|
||||
expect(objectOwnKeys[0]).toBe("0");
|
||||
expect(objectOwnKeys[1]).toBe("foo");
|
||||
expect(objectOwnKeys[2]).toBe("bar");
|
||||
expect(objectOwnKeys[3]).toBe(symbol);
|
||||
});
|
||||
|
||||
test("empty array has only 'length' own key", () => {
|
||||
var arrayOwnKeys = Reflect.ownKeys([]);
|
||||
expect(arrayOwnKeys instanceof Array).toBeTrue();
|
||||
expect(arrayOwnKeys).toHaveLength(1);
|
||||
expect(arrayOwnKeys[0]).toBe("length");
|
||||
});
|
||||
|
||||
test("array with some values has 'length' and indices own keys", () => {
|
||||
var arrayOwnKeys = Reflect.ownKeys(["foo", [], 123, undefined]);
|
||||
expect(arrayOwnKeys instanceof Array).toBeTrue();
|
||||
expect(arrayOwnKeys).toHaveLength(5);
|
||||
expect(arrayOwnKeys[0]).toBe("0");
|
||||
expect(arrayOwnKeys[1]).toBe("1");
|
||||
expect(arrayOwnKeys[2]).toBe("2");
|
||||
expect(arrayOwnKeys[3]).toBe("3");
|
||||
expect(arrayOwnKeys[4]).toBe("length");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue