Files
core2026/app/gateway-api/test/tournamentResetState.test.ts
T
Hide_D 346f796cfc fix: 모든 토너먼트 writer의 source revision을 원자화
API store뿐 아니라 월 자동 개막과 runtime clock shift도 공통 Lua writer를 사용한다. 프로필 초기화 시 revision key도 함께 제거한다.
2026-08-16 18:49:33 +00:00

36 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import {
buildTournamentRuntimeKeys,
clearTournamentRuntimeKeys,
} from '../src/orchestrator/gatewayOrchestrator.js';
describe('tournament reset state', () => {
it('targets every season-owned tournament key for the selected profile only', () => {
expect(buildTournamentRuntimeKeys('che:1010')).toEqual([
'sammo:che:1010:tournament:state',
'sammo:che:1010:tournament:participants',
'sammo:che:1010:tournament:matches',
'sammo:che:1010:tournament:betting',
'sammo:che:1010:tournament:source-revision',
]);
expect(buildTournamentRuntimeKeys('hwe:915')).not.toContain('sammo:che:1010:tournament:state');
});
it('deletes the tournament state as one profile-scoped reset operation', async () => {
const calls: string[][] = [];
const deleted = await clearTournamentRuntimeKeys(
{
del: async (keys) => {
calls.push(keys);
return keys.length;
},
},
'che:1010'
);
expect(deleted).toBe(5);
expect(calls).toEqual([buildTournamentRuntimeKeys('che:1010')]);
});
});