fix(game-ui): 내 정보 전투 누적 수치를 실제 기록에 연결
명장 일람과 같은 rank_data 원천을 general.me에 투영하고 Ref 비율식으로 표시한다. 전투 누적과 무쌍 승리수 배율을 회귀 테스트로 고정한다.
This commit is contained in:
@@ -85,6 +85,7 @@ const createContext = (options: {
|
||||
troopLeaderAction?: string | null;
|
||||
refreshScore?: number;
|
||||
refreshScoreTotal?: number;
|
||||
rankRows?: Array<{ type: string; value: number }>;
|
||||
requestId?: string;
|
||||
transaction?: ReturnType<typeof vi.fn>;
|
||||
}) => {
|
||||
@@ -128,6 +129,9 @@ const createContext = (options: {
|
||||
refreshScoreTotal: options.refreshScoreTotal ?? 0,
|
||||
})),
|
||||
},
|
||||
rankData: {
|
||||
findMany: vi.fn(async () => options.rankRows ?? []),
|
||||
},
|
||||
city: {
|
||||
findUnique: vi.fn(async () => options.city ?? null),
|
||||
aggregate: vi.fn(async () => ({
|
||||
@@ -206,6 +210,41 @@ const createContext = (options: {
|
||||
};
|
||||
|
||||
describe('in-game my information ownership', () => {
|
||||
it('returns the owned general battle records from the same rank_data source used by rankings', async () => {
|
||||
const fixture = createContext({
|
||||
me: buildGeneral({ meta: { belong: 4, rank_killnum: 999 } }),
|
||||
rankRows: [
|
||||
{ type: 'firenum', value: 12 },
|
||||
{ type: 'warnum', value: 8 },
|
||||
{ type: 'killnum', value: 5 },
|
||||
{ type: 'deathnum', value: 3 },
|
||||
{ type: 'killcrew', value: 12_345 },
|
||||
{ type: 'deathcrew', value: 6_789 },
|
||||
],
|
||||
});
|
||||
|
||||
await expect(appRouter.createCaller(fixture.context).general.me()).resolves.toMatchObject({
|
||||
general: {
|
||||
records: {
|
||||
battles: 8,
|
||||
strategies: 12,
|
||||
serviceYears: 4,
|
||||
wins: 5,
|
||||
losses: 3,
|
||||
killedCrew: 12_345,
|
||||
lostCrew: 6_789,
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(fixture.db.rankData.findMany).toHaveBeenCalledWith({
|
||||
where: {
|
||||
generalId: 7,
|
||||
type: { in: ['firenum', 'warnum', 'killnum', 'deathnum', 'killcrew', 'deathcrew'] },
|
||||
},
|
||||
select: { type: true, value: true },
|
||||
});
|
||||
});
|
||||
|
||||
it('returns every ref progress-bar input from the owned general and current city read model', async () => {
|
||||
const fixture = createContext({
|
||||
me: buildGeneral({
|
||||
|
||||
Reference in New Issue
Block a user