// Session 43 — Phase 6 mobile + cosmetics.

const fs = require('fs');
const path = require('path');
const WEB = path.join(__dirname, '..', '..', 'web', 'src');
const read = (rel) => fs.readFileSync(path.join(WEB, rel), 'utf8');

describe('Player profile hero name (mobile truncation fix)', () => {
  const page = read('app/player/[name]/page.tsx');
  const css = read('app/globals.css');
  it('hero name uses overflow-safe wrapping (no clipping)', () => {
    expect(page).toContain('player-hero-name');
    expect(page).toContain("overflowWrap: 'anywhere'");
  });
  it('mobile CSS shrinks + wraps the hero name', () => {
    expect(css).toMatch(/\.player-hero-name\s*\{[^}]*font-size: 24px/);
  });
});

describe('No runtime font CDN (Session 41 fix still holds)', () => {
  it('layout has no fonts.googleapis.com stylesheet link', () => {
    const layout = read('app/layout.tsx');
    expect(layout).not.toMatch(/href=["'][^"']*fonts\.googleapis\.com/);
    expect(layout).toContain("from 'next/font/google'");
  });
});
