// Session 44 — Phase 5: depth chart Next proxies exist (were 404ing).

const fs = require('fs');
const path = require('path');
const API = path.join(__dirname, '..', '..', 'web', 'src', 'app', 'api', 'stats');

describe('Depth chart Next proxy routes', () => {
  it.each([
    ['lineup/[team]/route.ts', '/api/stats/lineup/'],
    ['depth/[team]/route.ts', '/api/stats/depth/'],
    ['cascade/[player]/route.ts', '/api/stats/cascade/'],
  ])('%s exists and forwards to the Express backend', (rel, fwd) => {
    const p = path.join(API, rel);
    expect(fs.existsSync(p)).toBe(true);
    const src = fs.readFileSync(p, 'utf8');
    expect(src).toContain('BACKEND_URL');
    expect(src).toContain(fwd);
  });
});
