import assert from 'node:assert/strict'; import test from 'node:test'; import type { CompetitionGameView } from '@lolympus/contracts'; import { riotMatchIdForDisplay } from '../src/lib/internal-game-evidence.ts'; test('keeps a real Riot ID visible even when analysis is missing', () => { const game = { gameId: 'game-1', riotMatchId: 'KR_123', analysisAvailability: 'missing', }; const official = { evidence: { type: 'riot', riotMatchId: 'KR_123' }, } as CompetitionGameView; assert.equal(riotMatchIdForDisplay(game, official), 'KR_123'); }); test('does not label a legacy evidence reference as a Riot ID', () => { const official = { evidence: { type: 'legacy', legacyReference: 'KR_123' }, } as CompetitionGameView; assert.equal( riotMatchIdForDisplay({ riotMatchId: 'KR_123' }, official), null, ); assert.equal( riotMatchIdForDisplay({ riotMatchId: 'match:legacy:123' }), null, ); assert.equal(riotMatchIdForDisplay({ riotMatchId: 'KR_TEMP_123' }), null); }); test('shows a real Riot ID on unmigrated records and hides unresolved official references', () => { assert.equal(riotMatchIdForDisplay({ riotMatchId: 'KR_123' }), 'KR_123'); assert.equal(riotMatchIdForDisplay({ riotMatchId: 'NA1_123' }), 'NA1_123'); assert.equal( riotMatchIdForDisplay({ riotMatchId: 'KR_123', gameId: 'unresolved' }), null, ); });