/**
 * Tests for PWA Manifest
 *
 * Story 3.4: Verify manifest configuration
 *
 * Note: Next.js 16 handles manifest.ts as a special route file.
 * This test validates the structure by reading the source file directly.
 */

import { describe, it, expect } from 'vitest';
import { readFileSync } from 'fs';
import { join } from 'path';

describe('PWA Manifest', () => {
  const manifestContent = readFileSync(
    join(__dirname, 'manifest.ts'),
    'utf-8'
  );

  describe('Required Manifest Properties', () => {
    it('should have app name "Test01"', () => {
      expect(manifestContent).toContain("name: 'Test01'");
    });

    it('should have short name "Test01"', () => {
      expect(manifestContent).toContain("short_name: 'Test01'");
    });

    it('should have start_url set to root', () => {
      expect(manifestContent).toContain("start_url: '/'");
    });

    it('should have display mode set to standalone', () => {
      expect(manifestContent).toContain("display: 'standalone'");
    });

    it('should have portrait orientation', () => {
      expect(manifestContent).toContain("orientation: 'portrait'");
    });
  });

  describe('Theme Colors (Morning Mist Palette)', () => {
    it('should have correct background_color', () => {
      expect(manifestContent).toContain("background_color: '#F8FAFC'");
    });

    it('should have correct theme_color', () => {
      expect(manifestContent).toContain("theme_color: '#64748B'");
    });
  });

  describe('Icon Configuration', () => {
    it('should have 192x192 icon', () => {
      expect(manifestContent).toContain('/icons/icon-192x192.png');
      expect(manifestContent).toContain("'192x192'");
    });

    it('should have 512x512 icon', () => {
      expect(manifestContent).toContain('/icons/icon-512x512.png');
      expect(manifestContent).toContain("'512x512'");
    });

    it('should have maskable purpose', () => {
      expect(manifestContent).toContain("purpose: 'any maskable'");
    });
  });

  describe('Description', () => {
    it('should have a description', () => {
      expect(manifestContent).toContain('description:');
    });
  });
});
