Everywhere: Hoist the Libraries folder to the top-level

This commit is contained in:
Timothy Flynn 2024-11-09 12:25:08 -05:00 committed by Andreas Kling
commit 93712b24bf
Notes: github-actions[bot] 2024-11-10 11:51:52 +00:00
4547 changed files with 104 additions and 113 deletions

View file

@ -0,0 +1,42 @@
test("length is 2", () => {
expect(Object.assign).toHaveLength(2);
});
describe("errors", () => {
test("first argument must coercible to object", () => {
expect(() => {
Object.assign(null);
}).toThrowWithMessage(TypeError, "ToObject on null or undefined");
expect(() => {
Object.assign(undefined);
}).toThrowWithMessage(TypeError, "ToObject on null or undefined");
});
});
describe("normal behavior", () => {
test("returns first argument coerced to object", () => {
const o = {};
expect(Object.assign(o)).toBe(o);
expect(Object.assign(o, {})).toBe(o);
expect(Object.assign(42)).toEqual(new Number(42));
});
test("alters first argument object if sources are given", () => {
const o = { foo: 0 };
expect(Object.assign(o, { foo: 1 })).toBe(o);
expect(o).toEqual({ foo: 1 });
});
test("merges objects", () => {
const s = Symbol();
expect(
Object.assign(
{},
{ foo: 0, bar: "baz" },
{ [s]: [1, 2, 3] },
{ foo: 1 },
{ [42]: "test" }
)
).toEqual({ foo: 1, bar: "baz", [s]: [1, 2, 3], 42: "test" });
});
});