import { fakeAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { BreadcrumbService } from '@core/breadcrumb';
import { createComponentFactory, mockProvider, Spectator } from '@ngneat/spectator';
import { UiFilter, UiInputGroupSelectorPipe } from '@ui/filter';
import { hot } from 'jasmine-marbles';
import { MockPipe } from 'ng-mocks';
import { EMPTY } from 'rxjs';
import { GoodsInSearchStore } from '../goods-in-search.store';
// import { GoodsInSearchService } from '../goods-in-search.service';
import { GoodsInSearchMainComponent } from './goods-in-search-main.component';

describe('GoodsInSearchMainComponent', () => {
  let spectator: Spectator<GoodsInSearchMainComponent>;
  const createComponent = createComponentFactory({
    component: GoodsInSearchMainComponent,
    imports: [RouterTestingModule],
    providers: [
      mockProvider(BreadcrumbService),
      mockProvider(GoodsInSearchStore, {
        loadSettings: async () => {},
      }),
    ],
    declarations: [MockPipe(UiInputGroupSelectorPipe)],
  });

  // let goodsInSearchServiceMock: jasmine.SpyObj<GoodsInSearchService>;

  beforeEach(() => {
    spectator = createComponent();
    // goodsInSearchServiceMock = spectator.inject(GoodsInSearchService);
  });

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

  // describe('get settings()', () => {
  //   it('should retun the settings from GoodsInSearchService.settings', () => {
  //     const settings = UiFilter.create({});
  //     goodsInSearchServiceMock.settings = settings;
  //     expect(spectator.component.settings).toBe(settings);
  //   });
  // });

  // describe('ngOnInit()', () => {
  //   it('should subscribe to settingsChange and add it to the subscriptions', () => {
  //     spyOn(spectator.component['_subscriptions'], 'add');

  //     spectator.component.ngOnInit();

  //     expect(spectator.component['_subscriptions'].add).toHaveBeenCalled();
  //   });
  // });

  // describe('ngOnDestroy()', () => {
  //   it('should unsubscribe the subscriptions', () => {
  //     spyOn(spectator.component['_subscriptions'], 'unsubscribe');

  //     spectator.component.ngOnDestroy();

  //     expect(spectator.component['_subscriptions'].unsubscribe).toHaveBeenCalled();
  //   });
  // });

  // describe('search()', () => {
  //   it('should call GoodsInSearchService.search() to start a search', () => {
  //     spectator.component.search();
  //     expect(goodsInSearchServiceMock.search).toHaveBeenCalled();
  //   });
  // });
});
