mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +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,67 +1,67 @@
|
|||
test("property initialization", () => {
|
||||
class A {
|
||||
constructor() {
|
||||
this.x = 3;
|
||||
class A {
|
||||
constructor() {
|
||||
this.x = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expect(new A().x).toBe(3);
|
||||
expect(new A().x).toBe(3);
|
||||
});
|
||||
|
||||
test("method initialization", () => {
|
||||
class A {
|
||||
constructor() {
|
||||
this.x = () => 10;
|
||||
class A {
|
||||
constructor() {
|
||||
this.x = () => 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expect(new A().x()).toBe(10);
|
||||
expect(new A().x()).toBe(10);
|
||||
});
|
||||
|
||||
test("initialize to class method", () => {
|
||||
class A {
|
||||
constructor() {
|
||||
this.x = this.method;
|
||||
class A {
|
||||
constructor() {
|
||||
this.x = this.method;
|
||||
}
|
||||
|
||||
method() {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
||||
method() {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
||||
expect(new A().x()).toBe(10);
|
||||
expect(new A().x()).toBe(10);
|
||||
});
|
||||
|
||||
test("constructor length affects class length", () => {
|
||||
class A {
|
||||
constructor() {}
|
||||
}
|
||||
class A {
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
expect(A).toHaveLength(0);
|
||||
expect(A).toHaveLength(0);
|
||||
|
||||
class B {
|
||||
constructor(a, b, c = 2) {}
|
||||
}
|
||||
class B {
|
||||
constructor(a, b, c = 2) {}
|
||||
}
|
||||
|
||||
expect(B).toHaveLength(2);
|
||||
expect(B).toHaveLength(2);
|
||||
});
|
||||
|
||||
test.skip("must be invoked with 'new'", () => {
|
||||
class A {
|
||||
constructor() {}
|
||||
}
|
||||
class A {
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
expect(() => {
|
||||
A();
|
||||
}).toThrow(TypeError); // FIXME: Add message when this test works
|
||||
expect(() => {
|
||||
A();
|
||||
}).toThrow(TypeError); // FIXME: Add message when this test works
|
||||
|
||||
expect(() => {
|
||||
A.prototype.constructor();
|
||||
}).toThrow(TypeError); // FIXME: Add message when this test works
|
||||
expect(() => {
|
||||
A.prototype.constructor();
|
||||
}).toThrow(TypeError); // FIXME: Add message when this test works
|
||||
});
|
||||
|
||||
test("implicit constructor", () => {
|
||||
class A {}
|
||||
class A {}
|
||||
|
||||
expect(new A()).toBeInstanceOf(A);
|
||||
expect(new A()).toBeInstanceOf(A);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue