Tidy up service test fixtures and type assertions.
- scoreboardService·statsService 테스트에서 날짜 리터럴에 DateString 타입 단언을 추가해 타입 안정성을 보정했습니다. - chatToolService·gameSyncService 테스트의 사소한 픽스처/단언을 정리했습니다.
This commit is contained in:
parent
229a199bbb
commit
75a35d965a
@ -73,7 +73,7 @@ describe("chatToolService", () => {
|
||||
expect(pickTeam({ team: "ZZ" }, ctx)).toBe(TeamCode.HH);
|
||||
});
|
||||
it("컨텍스트 팀도 없으면 null", () => {
|
||||
expect(pickTeam({}, { teamCode: null, date: ctx.date })).toBeNull();
|
||||
expect(pickTeam({}, { uid: ctx.uid, teamCode: null, date: ctx.date })).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -23,6 +23,8 @@ function baseGame(overrides: Partial<ScheduleGame> = {}): ScheduleGame {
|
||||
broadcast: "KN-T",
|
||||
note: "-",
|
||||
gameId: "20260412HTLG0",
|
||||
awayStartingPitcher: null,
|
||||
homeStartingPitcher: null,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import {
|
||||
precomputeScoreboardCache,
|
||||
snapshotRankForUser,
|
||||
} from "../../src/services/rankSnapshotService";
|
||||
import { todayKst } from "../../src/types/dateString";
|
||||
import { todayKst, type DateString } from "../../src/types/dateString";
|
||||
import { TeamCode, type RankSnapshot } from "../../src/types/panit";
|
||||
|
||||
interface SeedUser {
|
||||
@ -48,7 +48,7 @@ describe("scoreboardService.getScoreboard", () => {
|
||||
uid: `u${i}`,
|
||||
displayName: `유저${i}`,
|
||||
tierPoints: i * 10,
|
||||
rankSnapshot: { date: "2026-04-21", overall: 20 - i },
|
||||
rankSnapshot: { date: "2026-04-21" as DateString, overall: 20 - i },
|
||||
});
|
||||
}
|
||||
await precomputeScoreboardCache(todayKst());
|
||||
@ -142,7 +142,7 @@ describe("scoreboardService.getScoreboard", () => {
|
||||
displayName: "LG1",
|
||||
tierPoints: 100,
|
||||
favoriteTeamCode: TeamCode.LG,
|
||||
rankSnapshot: { date: "2026-04-21", overall: 5, team: 3, teamCode: TeamCode.LG },
|
||||
rankSnapshot: { date: "2026-04-21" as DateString, overall: 5, team: 3, teamCode: TeamCode.LG },
|
||||
});
|
||||
await seedUser({
|
||||
uid: "lg2",
|
||||
@ -161,7 +161,7 @@ describe("scoreboardService.getScoreboard", () => {
|
||||
displayName: "나",
|
||||
tierPoints: 80,
|
||||
favoriteTeamCode: TeamCode.LG,
|
||||
rankSnapshot: { date: "2026-04-21", overall: 7, team: 5, teamCode: TeamCode.LG },
|
||||
rankSnapshot: { date: "2026-04-21" as DateString, overall: 7, team: 5, teamCode: TeamCode.LG },
|
||||
});
|
||||
await precomputeScoreboardCache(todayKst());
|
||||
|
||||
@ -181,7 +181,7 @@ describe("scoreboardService.getScoreboard", () => {
|
||||
displayName: "나",
|
||||
tierPoints: 80,
|
||||
favoriteTeamCode: TeamCode.NC,
|
||||
rankSnapshot: { date: "2026-04-21", overall: 1, team: 1, teamCode: TeamCode.LG },
|
||||
rankSnapshot: { date: "2026-04-21" as DateString, overall: 1, team: 1, teamCode: TeamCode.LG },
|
||||
});
|
||||
await precomputeScoreboardCache(todayKst());
|
||||
|
||||
@ -240,7 +240,7 @@ describe("rankSnapshotService.snapshotRankForUser", () => {
|
||||
tierPoints: 150, favoriteTeamCode: TeamCode.KT,
|
||||
});
|
||||
|
||||
await snapshotRankForUser("b", "2026-04-22");
|
||||
await snapshotRankForUser("b", "2026-04-22" as DateString);
|
||||
|
||||
const doc = await firestore.collection("users").doc("b").get();
|
||||
const snap = doc.data()!.rankSnapshot as RankSnapshot;
|
||||
@ -258,7 +258,7 @@ describe("rankSnapshotService.snapshotRankForUser", () => {
|
||||
tierPoints: 0,
|
||||
});
|
||||
|
||||
await snapshotRankForUser("zero", "2026-04-22");
|
||||
await snapshotRankForUser("zero", "2026-04-22" as DateString);
|
||||
|
||||
const doc = await firestore.collection("users").doc("zero").get();
|
||||
expect(doc.data()!.rankSnapshot).toBeUndefined();
|
||||
@ -270,7 +270,7 @@ describe("rankSnapshotService.snapshotRankForUser", () => {
|
||||
tierPoints: 50,
|
||||
});
|
||||
|
||||
await snapshotRankForUser("solo", "2026-04-22");
|
||||
await snapshotRankForUser("solo", "2026-04-22" as DateString);
|
||||
|
||||
const doc = await firestore.collection("users").doc("solo").get();
|
||||
const snap = doc.data()!.rankSnapshot as RankSnapshot;
|
||||
|
||||
@ -193,7 +193,7 @@ describe("statsService.getStats — 캐시 forDate 검증", () => {
|
||||
weeklyPredictions: 0,
|
||||
currentLevel: 1,
|
||||
progress: 0,
|
||||
tier: "Bronze",
|
||||
tier: "bronze",
|
||||
tierPoints: 0,
|
||||
tickets: { dailyAllKill: 0, weeklyMaster: 0 },
|
||||
updatedAt: Date.now(),
|
||||
@ -220,7 +220,7 @@ describe("statsService.getStats — 캐시 forDate 검증", () => {
|
||||
weeklyPredictions: 0,
|
||||
currentLevel: 1,
|
||||
progress: 0,
|
||||
tier: "Bronze",
|
||||
tier: "bronze",
|
||||
tierPoints: 0,
|
||||
tickets: { dailyAllKill: 0, weeklyMaster: 0 },
|
||||
updatedAt: Date.now() - 86_400_000,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user