mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-07 11:54:59 -04:00
Consolidate the Race Story section into a cohesive timeline surface: custom chapter-strip scrolling with active-card sync, unified segmented playback controls, chapter bands on the position graph with decimated axes and de-collided labels, map toggle gated by an on-mount replay/outline probe, and shared empty-state cards. Adds vitest coverage and visual snapshots. Note: replay/outline queries now probe on mount (not only when Map opens) so the toggle can be hidden before users hit a dead panel. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
958 B
TypeScript
34 lines
958 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { isReplayMapAvailable } from '../lib/replayMap'
|
|
import type { ReplayFramesResponse, TrackOutline } from '../types'
|
|
|
|
const outline: TrackOutline = {
|
|
circuit_key: 1,
|
|
bounds: { minX: 0, maxX: 100, minY: 0, maxY: 100 },
|
|
points: [{ x: 0, y: 0 }],
|
|
}
|
|
|
|
const replay: ReplayFramesResponse = {
|
|
session_key: 1,
|
|
interval_ms: 5000,
|
|
start_time: '2025-05-25T13:00:00Z',
|
|
frames: [
|
|
{ t: 0, cars: {} },
|
|
{ t: 5000, cars: {} },
|
|
],
|
|
}
|
|
|
|
describe('isReplayMapAvailable', () => {
|
|
it('returns true when frames and outline are present', () => {
|
|
expect(isReplayMapAvailable(replay, outline, false)).toBe(true)
|
|
})
|
|
|
|
it('returns false when frames are sparse', () => {
|
|
expect(isReplayMapAvailable({ ...replay, frames: [{ t: 0, cars: {} }] }, outline, false)).toBe(false)
|
|
})
|
|
|
|
it('returns false on query error', () => {
|
|
expect(isReplayMapAvailable(replay, outline, true)).toBe(false)
|
|
})
|
|
})
|