summaryrefslogtreecommitdiff
path: root/frontend/src/lib/projectSparkline.test.ts
blob: 65ffd26ec77dda509057c116ce4541f7b4555e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// @ts-nocheck
import { describe, expect, it } from 'vitest';
import { sparkFirstLast } from './dashboardMetrics';

describe('ProjectsPage sparkline data wiring (real render uses sparkFirstLast over run list)', () => {
  it('the runs list with project_id + result feeds per-project endpoints', () => {
    const runs = [
      { project_id: 'pA', created_at: '2026-01-05', result: { equity: [{ equity: 100 }, { equity: 110 }] } },
      { project_id: 'pB', created_at: null, result: null }
    ];
    const m = sparkFirstLast(runs);
    expect([...m.keys()]).toEqual(['pA']);
    expect(m.get('pA')).toEqual({ first: 100, last: 110 });
  });
});