import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
import { FormsModule } from '@angular/forms';

import { ModernHeaderComponent } from './modern-header.component';

describe('ModernHeaderComponent', () => {
  let component: ModernHeaderComponent;
  let fixture: ComponentFixture<ModernHeaderComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [ModernHeaderComponent],
      imports: [
        RouterTestingModule,
        MatIconModule,
        MatTooltipModule,
        FormsModule
      ]
    }).compileComponents();

    fixture = TestBed.createComponent(ModernHeaderComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });

  it('should generate avatar from name', () => {
    const avatar = (component as any).generateAvatar('Jean Dupont');
    expect(avatar).toBe('JD');
  });

  it('should format labels correctly', () => {
    const formatted = (component as any).formatLabel('customers');
    expect(formatted).toBe('Customers');
  });
});