Skip to content

Commit 96745ce

Browse files
committed
fix noImplicitAny errors in spec files and exclude test-helpers from build
Add type assertions to empty arrays and null values in RemoveCancelledMatches and notifications.service spec files. Exclude test-helpers from tsconfig.build to prevent jest mocks from leaking into production builds.
1 parent cf34aed commit 96745ce

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/matches/jobs/RemoveCancelledMatches.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jest.mock("../../utilities/QueueProcessors", () => ({
88

99
import { RemoveCancelledMatches } from "./RemoveCancelledMatches";
1010

11-
function createProcessor(matches = []) {
11+
function createProcessor(matches: any[] = []) {
1212
const hasura = {
1313
query: jest.fn().mockResolvedValue({ matches }),
1414
mutation: jest.fn().mockResolvedValue({}),
@@ -63,7 +63,7 @@ describe("RemoveCancelledMatches", () => {
6363
{ id: "d1", file: "demos/d1.dem" },
6464
{ id: "d2", file: "demos/d2.dem" },
6565
],
66-
rounds: [],
66+
rounds: [] as any[],
6767
},
6868
],
6969
},
@@ -92,8 +92,8 @@ describe("RemoveCancelledMatches", () => {
9292

9393
it("deletes match records after demo cleanup", async () => {
9494
const matches = [
95-
{ id: "m1", server_id: "s1", match_maps: [{ demos: [], rounds: [] }] },
96-
{ id: "m2", server_id: "s2", match_maps: [{ demos: [], rounds: [] }] },
95+
{ id: "m1", server_id: "s1", match_maps: [{ demos: [] as any[], rounds: [] as any[] }] },
96+
{ id: "m2", server_id: "s2", match_maps: [{ demos: [] as any[], rounds: [] as any[] }] },
9797
];
9898
const { processor, hasura } = createProcessor(matches);
9999

@@ -117,8 +117,8 @@ describe("RemoveCancelledMatches", () => {
117117

118118
it("logs count when matches removed", async () => {
119119
const matches = [
120-
{ id: "m1", server_id: "s1", match_maps: [{ demos: [], rounds: [] }] },
121-
{ id: "m2", server_id: "s2", match_maps: [{ demos: [], rounds: [] }] },
120+
{ id: "m1", server_id: "s1", match_maps: [{ demos: [] as any[], rounds: [] as any[] }] },
121+
{ id: "m2", server_id: "s2", match_maps: [{ demos: [] as any[], rounds: [] as any[] }] },
122122
];
123123
const { processor, logger } = createProcessor(matches);
124124

src/notifications/notifications.service.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ describe("NotificationsService", () => {
9797
organizer_steam_id: "org-1",
9898
organizers: [{ steam_id: "org-2" }],
9999
discord_notifications_enabled: false,
100-
discord_webhook: null,
101-
discord_role_id: null,
100+
discord_webhook: null as string | null,
101+
discord_role_id: null as string | null,
102102
discord_notify_Live: false,
103103
};
104104

@@ -125,10 +125,10 @@ describe("NotificationsService", () => {
125125
id: "t1",
126126
name: "Cup",
127127
organizer_steam_id: "org-1",
128-
organizers: [],
128+
organizers: [] as any[],
129129
discord_notifications_enabled: true,
130130
discord_webhook: "https://discord.com/api/webhooks/123/abc",
131-
discord_role_id: null,
131+
discord_role_id: null as string | null,
132132
discord_notify_Live: true,
133133
};
134134

tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "./tsconfig.json",
3-
"exclude": ["node_modules", "test", "dist", "**/*spec.ts", "generated"]
3+
"exclude": ["node_modules", "test", "dist", "**/*spec.ts", "**/test-helpers/**", "generated"]
44
}

0 commit comments

Comments
 (0)