import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SoftwareProfileComponent } from './software-profile.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatOptionModule } from '@angular/material/core';
import { MatDividerModule } from '@angular/material/divider';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSelectModule } from '@angular/material/select';
import { MatTableModule } from '@angular/material/table';
import { MatTooltipModule } from '@angular/material/tooltip';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
import { TranslateModule } from '@ngx-translate/core';
import { JoyrideModule } from 'ngx-joyride';
import { ConfigService } from '@services/config.service';

describe('SoftwareProfileComponent', () => {
  let component: SoftwareProfileComponent;
  let fixture: ComponentFixture<SoftwareProfileComponent>;
  let mockConfigService: jasmine.SpyObj<ConfigService>;

  beforeEach(async () => {
    const configServiceSpy = jasmine.createSpyObj('ConfigService', [], { apiUrl: 'http://mock-api-url' });

    Object.defineProperty(window, 'getComputedStyle', {
      value: () => ({
        getPropertyValue: (prop: string) => '',
      }),
    });

    await TestBed.configureTestingModule({
      declarations: [SoftwareProfileComponent],
      imports: [
        HttpClientTestingModule,
        ToastrModule.forRoot(),
        NoopAnimationsModule,
        MatDividerModule,
        MatFormFieldModule,
        MatInputModule,
        MatIconModule,
        MatButtonModule,
        MatTableModule,
        MatPaginatorModule,
        MatTooltipModule,
        FormsModule,
        MatProgressSpinnerModule,
        MatOptionModule,
        ReactiveFormsModule,
        MatSelectModule,
        TranslateModule.forRoot(),
        JoyrideModule.forRoot(),
      ],
      providers: [
        { provide: ConfigService, useValue: configServiceSpy }
      ]
    })
    .compileComponents();

    mockConfigService = TestBed.inject(ConfigService) as jasmine.SpyObj<ConfigService>;
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(SoftwareProfileComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

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