1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibJS: Indent tests with 4 spaces instead of 2

This commit is contained in:
Matthew Olsson 2020-07-06 07:37:45 -07:00 committed by Andreas Kling
parent 15de2eda2b
commit 1ef573eb30
261 changed files with 8536 additions and 8497 deletions

View file

@ -1,82 +1,82 @@
const testObjSpread = obj => {
expect(obj).toEqual({
foo: 0,
bar: 1,
baz: 2,
qux: 3,
});
expect(obj).toEqual({
foo: 0,
bar: 1,
baz: 2,
qux: 3,
});
};
const testObjStrSpread = obj => {
expect(obj).toEqual(["a", "b", "c", "d"]);
expect(obj).toEqual(["a", "b", "c", "d"]);
};
test("spread object literal inside object literal", () => {
let obj = {
foo: 0,
...{ bar: 1, baz: 2 },
qux: 3,
};
testObjSpread(obj);
let obj = {
foo: 0,
...{ bar: 1, baz: 2 },
qux: 3,
};
testObjSpread(obj);
});
test("spread object with assigned property inside object literal", () => {
obj = { foo: 0, bar: 1, baz: 2 };
obj.qux = 3;
testObjSpread({ ...obj });
obj = { foo: 0, bar: 1, baz: 2 };
obj.qux = 3;
testObjSpread({ ...obj });
});
test("spread object inside object literal", () => {
let a = { bar: 1, baz: 2 };
obj = { foo: 0, ...a, qux: 3 };
testObjSpread(obj);
let a = { bar: 1, baz: 2 };
obj = { foo: 0, ...a, qux: 3 };
testObjSpread(obj);
});
test("complex nested object spreading", () => {
obj = {
...{},
...{
...{ foo: 0, bar: 1, baz: 2 },
},
qux: 3,
};
testObjSpread(obj);
obj = {
...{},
...{
...{ foo: 0, bar: 1, baz: 2 },
},
qux: 3,
};
testObjSpread(obj);
});
test("spread string in object literal", () => {
obj = { ..."abcd" };
testObjStrSpread(obj);
obj = { ..."abcd" };
testObjStrSpread(obj);
});
test("spread array in object literal", () => {
obj = { ...["a", "b", "c", "d"] };
testObjStrSpread(obj);
obj = { ...["a", "b", "c", "d"] };
testObjStrSpread(obj);
});
test("spread string object in object literal", () => {
obj = { ...String("abcd") };
testObjStrSpread(obj);
obj = { ...String("abcd") };
testObjStrSpread(obj);
});
test("spread object with non-enumerable property", () => {
a = { foo: 0 };
Object.defineProperty(a, "bar", {
value: 1,
enumerable: false,
});
obj = { ...a };
expect(obj.foo).toBe(0);
expect(obj).not.toHaveProperty("bar");
a = { foo: 0 };
Object.defineProperty(a, "bar", {
value: 1,
enumerable: false,
});
obj = { ...a };
expect(obj.foo).toBe(0);
expect(obj).not.toHaveProperty("bar");
});
test("spreading non-spreadable values", () => {
let empty = {
...undefined,
...null,
...1,
...true,
...function () {},
...Date,
};
expect(Object.getOwnPropertyNames(empty)).toHaveLength(0);
let empty = {
...undefined,
...null,
...1,
...true,
...function () {},
...Date,
};
expect(Object.getOwnPropertyNames(empty)).toHaveLength(0);
});