Skip to content

Commit 6d64be9

Browse files
authored
Apply prettier formatting to tests directory (roblox-ts#2788)
1 parent 0527970 commit 6d64be9

25 files changed

+171
-286
lines changed

.devcontainer/devcontainer.json

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
"dockerfile": "Dockerfile"
55
},
66
"postCreateCommand": ".devcontainer/setup-playground.sh",
7-
"extensions": [
8-
"editorconfig.editorconfig",
9-
"dbaeumer.vscode-eslint"
10-
],
11-
"forwardPorts": [
12-
34872
13-
]
7+
"extensions": ["editorconfig.editorconfig", "dbaeumer.vscode-eslint"],
8+
"forwardPorts": [34872]
149
}

.prettierignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
*.yml
22
/out
33
/node_modules
4-
/tests
5-
/.devcontainer
64
/CHANGELOG.md

tests/default.project.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"name": "roblox-ts-tests",
3-
"globIgnorePaths": [
4-
"**/package.json",
5-
"**/tsconfig.json"
6-
],
3+
"globIgnorePaths": ["**/package.json", "**/tsconfig.json"],
74
"tree": {
85
"$className": "DataModel",
96
"ReplicatedStorage": {

tests/src/diagnostics/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
### Untested Diagnostics
2-
- **noMacroExtends**: cannot test without also invoking noConstructorMacroWithoutNew
2+
3+
- **noMacroExtends**: cannot test without also invoking noConstructorMacroWithoutNew
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class Foo {
2-
public bar<T extends string>(arg: T) {
3-
return arg;
4-
}
2+
public bar<T extends string>(arg: T) {
3+
return arg;
4+
}
55
}
66

77
const foo = new Foo();
8-
const bar = foo.bar<"hello">;
8+
const bar = foo.bar<"hello">;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const obj = {
22
...new Map(),
3-
}
3+
};

tests/src/main.server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { ServerScriptService } from "@rbxts/services";
44
import TestEZ from "@rbxts/testez";
55

6-
const results = TestEZ.TestBootstrap.run([ ServerScriptService.tests ]);
6+
const results = TestEZ.TestBootstrap.run([ServerScriptService.tests]);
77
if (results.errors.size() > 0 || results.failureCount > 0) {
88
error("Tests failed!");
99
}

tests/src/tests/array.spec.ts

+44-44
Original file line numberDiff line numberDiff line change
@@ -453,50 +453,50 @@ export = () => {
453453
type StaticArguments<T> = T extends [TypeGuard<infer A>]
454454
? [A]
455455
: T extends [TypeGuard<infer A>, TypeGuard<infer B>]
456-
? [A, B]
457-
: T extends [TypeGuard<infer A>, TypeGuard<infer B>, TypeGuard<infer C>]
458-
? [A, B, C]
459-
: T extends [TypeGuard<infer A>, TypeGuard<infer B>, TypeGuard<infer C>, TypeGuard<infer D>]
460-
? [A, B, C, D]
461-
: T extends [
462-
TypeGuard<infer A>,
463-
TypeGuard<infer B>,
464-
TypeGuard<infer C>,
465-
TypeGuard<infer D>,
466-
TypeGuard<infer E>,
467-
]
468-
? [A, B, C, D, E]
469-
: T extends [
470-
TypeGuard<infer A>,
471-
TypeGuard<infer B>,
472-
TypeGuard<infer C>,
473-
TypeGuard<infer D>,
474-
TypeGuard<infer E>,
475-
TypeGuard<infer F>,
476-
]
477-
? [A, B, C, D, E, F]
478-
: T extends [
479-
TypeGuard<infer A>,
480-
TypeGuard<infer B>,
481-
TypeGuard<infer C>,
482-
TypeGuard<infer D>,
483-
TypeGuard<infer E>,
484-
TypeGuard<infer F>,
485-
TypeGuard<infer G>,
486-
]
487-
? [A, B, C, D, E, F, G]
488-
: T extends [
489-
TypeGuard<infer A>,
490-
TypeGuard<infer B>,
491-
TypeGuard<infer C>,
492-
TypeGuard<infer D>,
493-
TypeGuard<infer E>,
494-
TypeGuard<infer F>,
495-
TypeGuard<infer G>,
496-
TypeGuard<infer H>,
497-
]
498-
? [A, B, C, D, E, F, G, H]
499-
: Array<unknown>; // default, if user has more than 8 args then wtf they doing with their lives?!?
456+
? [A, B]
457+
: T extends [TypeGuard<infer A>, TypeGuard<infer B>, TypeGuard<infer C>]
458+
? [A, B, C]
459+
: T extends [TypeGuard<infer A>, TypeGuard<infer B>, TypeGuard<infer C>, TypeGuard<infer D>]
460+
? [A, B, C, D]
461+
: T extends [
462+
TypeGuard<infer A>,
463+
TypeGuard<infer B>,
464+
TypeGuard<infer C>,
465+
TypeGuard<infer D>,
466+
TypeGuard<infer E>,
467+
]
468+
? [A, B, C, D, E]
469+
: T extends [
470+
TypeGuard<infer A>,
471+
TypeGuard<infer B>,
472+
TypeGuard<infer C>,
473+
TypeGuard<infer D>,
474+
TypeGuard<infer E>,
475+
TypeGuard<infer F>,
476+
]
477+
? [A, B, C, D, E, F]
478+
: T extends [
479+
TypeGuard<infer A>,
480+
TypeGuard<infer B>,
481+
TypeGuard<infer C>,
482+
TypeGuard<infer D>,
483+
TypeGuard<infer E>,
484+
TypeGuard<infer F>,
485+
TypeGuard<infer G>,
486+
]
487+
? [A, B, C, D, E, F, G]
488+
: T extends [
489+
TypeGuard<infer A>,
490+
TypeGuard<infer B>,
491+
TypeGuard<infer C>,
492+
TypeGuard<infer D>,
493+
TypeGuard<infer E>,
494+
TypeGuard<infer F>,
495+
TypeGuard<infer G>,
496+
TypeGuard<infer H>,
497+
]
498+
? [A, B, C, D, E, F, G, H]
499+
: Array<unknown>; // default, if user has more than 8 args then wtf they doing with their lives?!?
500500

501501
function f<C extends Array<unknown>>(arr: StaticArguments<C>) {
502502
return [...arr];

tests/src/tests/assignment.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ export = () => {
1919

2020
it("should support logical null coalescing assignment expression", () => {
2121
let x: boolean | undefined;
22-
expect(x ??= true).to.equal(true);
22+
expect((x ??= true)).to.equal(true);
2323
expect(x).to.equal(true);
2424
});
2525

2626
it("should support logical or assignment expression", () => {
2727
let x = false;
28-
expect(x ||= true).to.equal(true);
28+
expect((x ||= true)).to.equal(true);
2929
expect(x).to.equal(true);
3030
});
3131

3232
it("should support logical and assignment expression", () => {
3333
let x = true;
34-
expect(x &&= false).to.equal(false);
34+
expect((x &&= false)).to.equal(false);
3535
expect(x).to.equal(false);
3636
});
3737
};

tests/src/tests/binary.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export = () => {
5454
this.b++;
5555
},
5656

57-
no: function() {
57+
no: function () {
5858
return (this[5] *= 7);
5959
},
6060

tests/src/tests/class.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export = () => {
314314
};
315315
}
316316
expect(new A.member().method() instanceof A).to.equal(true);
317-
})
317+
});
318318

319319
it("should support methods keys that emit prereqs", () => {
320320
let i = 0;

tests/src/tests/delete.spec.ts

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export = () => {
1414
};
1515

1616
delete myTrolly.apples;
17+
// prettier-ignore
1718
delete (myTrolly.pears);
1819

1920
expect(myTrolly.apples).to.equal(undefined);
@@ -28,6 +29,7 @@ export = () => {
2829
};
2930

3031
delete myTrolly?.apples;
32+
// prettier-ignore
3133
delete (myTrolly?.pears);
3234

3335
expect(myTrolly.apples).to.equal(undefined);
@@ -42,6 +44,7 @@ export = () => {
4244
};
4345

4446
delete myTrolly["apples"];
47+
// prettier-ignore
4548
delete (myTrolly["pears"]);
4649

4750
expect(myTrolly.apples).to.equal(undefined);
@@ -56,6 +59,7 @@ export = () => {
5659
};
5760

5861
delete myTrolly?.["apples"];
62+
// prettier-ignore
5963
delete (myTrolly?.["pears"]);
6064

6165
expect(myTrolly.apples).to.equal(undefined);
@@ -104,13 +108,15 @@ export = () => {
104108
};
105109

106110
expect(delete myTrolly.apples).to.equal(true);
111+
// prettier-ignore
107112
expect(delete (myTrolly.pears)).to.equal(true);
108113
});
109114

110115
it("should return true for optional property access", () => {
111116
const myTrolly = getFruitsOrUndefined();
112117

113118
expect(delete myTrolly?.apples).to.equal(true);
119+
// prettier-ignore
114120
expect(delete (myTrolly?.pears)).to.equal(true);
115121
});
116122

@@ -122,13 +128,15 @@ export = () => {
122128
};
123129

124130
expect(delete myTrolly["apples"]).to.equal(true);
131+
// prettier-ignore
125132
expect(delete (myTrolly["apples"])).to.equal(true);
126133
});
127134

128135
it("should return true for optional element access", () => {
129136
const myTrolly = getFruitsOrUndefined();
130137

131138
expect(delete myTrolly?.["apples"]).to.equal(true);
139+
// prettier-ignore
132140
expect(delete (myTrolly?.["pears"])).to.equal(true);
133141
});
134142
});

tests/src/tests/if.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export = () => {
1717
it("should support prereqs in elseif", () => {
1818
const array = [1];
1919
if (true) {
20-
} else if (array.pop() === 1) {}
20+
} else if (array.pop() === 1) {
21+
}
2122
expect(array.size()).to.equal(1);
2223
});
2324
};

tests/src/tests/loop.spec.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ export = () => {
389389

390390
it("should support indexing tuple as array", () => {
391391
const obj = {
392-
a:1,
393-
b:2,
394-
c:3,
395-
}
392+
a: 1,
393+
b: 2,
394+
c: 3,
395+
};
396396

397397
for (const tuple of pairs(obj)) {
398398
expect(tuple[1]).to.equal(obj[tuple[0]]);
@@ -406,16 +406,18 @@ export = () => {
406406
expect(tuple.size()).to.equal(1);
407407
break;
408408
}
409-
})
409+
});
410410

411411
it("should support iterator function with multiple returns when indexing tuple as array", () => {
412-
const longIterator: IterableFunction<LuaTuple<[boolean, boolean, boolean, boolean, boolean, boolean]>> =
413-
(() => [true, true, true, true, true, true] as LuaTuple<[boolean, boolean, boolean, boolean, boolean, boolean]>) as never;
412+
const longIterator: IterableFunction<LuaTuple<[boolean, boolean, boolean, boolean, boolean, boolean]>> = (() =>
413+
[true, true, true, true, true, true] as LuaTuple<
414+
[boolean, boolean, boolean, boolean, boolean, boolean]
415+
>) as never;
414416
for (const tuple of longIterator) {
415417
expect(tuple.size()).to.equal(6);
416418
break;
417419
}
418-
})
420+
});
419421

420422
it("should support the $range macro without step", () => {
421423
const hit = new Set<number>();

tests/src/tests/map.spec.ts

+6-24
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ export = () => {
1818
});
1919

2020
it("should support get and set", () => {
21-
const map = new Map<string, number>()
22-
.set("a", 1)
23-
.set("b", 2)
24-
.set("c", 3);
21+
const map = new Map<string, number>().set("a", 1).set("b", 2).set("c", 3);
2522
map.get("a");
2623
expect(map.get("a")).to.equal(1);
2724
expect(map.get("b")).to.equal(2);
@@ -32,10 +29,7 @@ export = () => {
3229
});
3330

3431
it("should support has", () => {
35-
const map = new Map<string, number>()
36-
.set("a", 1)
37-
.set("b", 2)
38-
.set("c", 3);
32+
const map = new Map<string, number>().set("a", 1).set("b", 2).set("c", 3);
3933
map.has("a");
4034
expect(map.has("a")).to.equal(true);
4135
expect(map.has("b")).to.equal(true);
@@ -44,30 +38,21 @@ export = () => {
4438
});
4539

4640
it("should support delete", () => {
47-
const map = new Map<string, number>()
48-
.set("a", 1)
49-
.set("b", 2)
50-
.set("c", 3);
41+
const map = new Map<string, number>().set("a", 1).set("b", 2).set("c", 3);
5142
const hadA = map.delete("a");
5243
expect(hadA).to.equal(true);
5344
expect(map.get("a")).never.to.be.ok();
5445
});
5546

5647
it("should support size", () => {
57-
const map = new Map<string, number>()
58-
.set("a", 1)
59-
.set("b", 2)
60-
.set("c", 3);
48+
const map = new Map<string, number>().set("a", 1).set("b", 2).set("c", 3);
6149
expect(map.size()).to.equal(3);
6250
map.delete("b");
6351
expect(map.size()).to.equal(2);
6452
});
6553

6654
it("should support clear", () => {
67-
const map = new Map<string, number>()
68-
.set("a", 1)
69-
.set("b", 2)
70-
.set("c", 3);
55+
const map = new Map<string, number>().set("a", 1).set("b", 2).set("c", 3);
7156
map.clear();
7257
expect(map.has("a")).to.equal(false);
7358
expect(map.has("b")).to.equal(false);
@@ -83,10 +68,7 @@ export = () => {
8368
let hitB = 0;
8469
let hitC = 0;
8570

86-
const map = new Map<string, number>()
87-
.set("a", 1)
88-
.set("b", 2)
89-
.set("c", 3);
71+
const map = new Map<string, number>().set("a", 1).set("b", 2).set("c", 3);
9072

9173
map.forEach((value, key, obj) => {
9274
if (key === "a" && value === 1) {

0 commit comments

Comments
 (0)