import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';

describe('Juozas Auto logo assets', () => {
  it('uses a reusable logo component in header and footer', () => {
    const header = readFileSync('src/components/Header.astro', 'utf8');
    const footer = readFileSync('src/components/Footer.astro', 'utf8');

    expect(header).toContain('Logo.astro');
    expect(header).toContain('<Logo />');
    expect(footer).toContain('Logo.astro');
    expect(footer).toContain('<Logo compact />');
  });

  it('publishes an svg favicon', () => {
    const layout = readFileSync('src/layouts/BaseLayout.astro', 'utf8');
    const favicon = readFileSync('public/favicon.svg', 'utf8');

    expect(layout).toContain('rel="icon"');
    expect(layout).toContain('/favicon.svg');
    expect(favicon).toContain('JA');
  });

  it('keeps compact logo spacing deterministic', () => {
    const logo = readFileSync('src/components/Logo.astro', 'utf8');

    expect(logo).not.toContain("'inline-flex items-center gap-3 text-ink'");
    expect(logo).toContain("compact ? 'gap-2' : 'gap-3'");
  });

  it('uses path geometry rather than live text for the favicon', () => {
    const favicon = readFileSync('public/favicon.svg', 'utf8');

    expect(favicon).not.toContain('<text');
    expect(favicon).toContain('aria-label="JA"');
  });
});
