mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
LibJS: Indent tests with 4 spaces instead of 2
This commit is contained in:
parent
15de2eda2b
commit
1ef573eb30
261 changed files with 8536 additions and 8497 deletions
|
@ -1,39 +1,44 @@
|
|||
test("length is 3", () => {
|
||||
expect(Reflect.apply).toHaveLength(3);
|
||||
expect(Reflect.apply).toHaveLength(3);
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("target must be a function", () => {
|
||||
[null, undefined, "foo", 123, NaN, Infinity, {}].forEach(value => {
|
||||
expect(() => {
|
||||
Reflect.apply(value);
|
||||
}).toThrowWithMessage(TypeError, "First argument of Reflect.apply() must be a function");
|
||||
test("target must be a function", () => {
|
||||
[null, undefined, "foo", 123, NaN, Infinity, {}].forEach(value => {
|
||||
expect(() => {
|
||||
Reflect.apply(value);
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"First argument of Reflect.apply() must be a function"
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("arguments list must be an object", () => {
|
||||
[null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
|
||||
expect(() => {
|
||||
Reflect.apply(() => {}, undefined, value);
|
||||
}).toThrowWithMessage(TypeError, "Arguments list must be an object");
|
||||
test("arguments list must be an object", () => {
|
||||
[null, undefined, "foo", 123, NaN, Infinity].forEach(value => {
|
||||
expect(() => {
|
||||
Reflect.apply(() => {}, undefined, value);
|
||||
}).toThrowWithMessage(TypeError, "Arguments list must be an object");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("normal behavior", () => {
|
||||
test("calling built-in functions", () => {
|
||||
expect(Reflect.apply(String.prototype.charAt, "foo", [0])).toBe("f");
|
||||
expect(Reflect.apply(Array.prototype.indexOf, ["hello", 123, "foo", "bar"], ["foo"])).toBe(2);
|
||||
});
|
||||
test("calling built-in functions", () => {
|
||||
expect(Reflect.apply(String.prototype.charAt, "foo", [0])).toBe("f");
|
||||
expect(Reflect.apply(Array.prototype.indexOf, ["hello", 123, "foo", "bar"], ["foo"])).toBe(
|
||||
2
|
||||
);
|
||||
});
|
||||
|
||||
test("|this| argument is forwarded to called function", () => {
|
||||
function Foo(foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
test("|this| argument is forwarded to called function", () => {
|
||||
function Foo(foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
var o = {};
|
||||
expect(o.foo).toBeUndefined();
|
||||
Reflect.apply(Foo, o, ["bar"]);
|
||||
expect(o.foo).toBe("bar");
|
||||
});
|
||||
var o = {};
|
||||
expect(o.foo).toBeUndefined();
|
||||
Reflect.apply(Foo, o, ["bar"]);
|
||||
expect(o.foo).toBe("bar");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue