+
+ describe('#content', () => {
+ it('should contain refresh button with correct icon', async () => {
+ let refreshButton = await loader.getHarness(MatButtonHarness.with({ selector: '#refreshButton' }));
+ expect(refreshButton).toBeTruthy();
+ expect(await refreshButton.getText()).toEqual('refresh');
+ });
+
+ it('should contain producers table', async () => {
+ const producersTableComponent = fixture.debugElement.nativeElement.querySelector('nrcp-producers-list');
+ expect(producersTableComponent).toBeTruthy();
+ });
+
+ it('should contain jobs table', async () => {
+ const jobsComponent = fixture.debugElement.nativeElement.querySelector('nrcp-jobs-list');
+ expect(jobsComponent).toBeTruthy();
+ });
+
+ it('should set correct dark mode from UIService', () => {
+ const uiService: UiService = TestBed.inject(UiService);
+ expect(component.darkMode).toBeTruthy();
+
+ uiService.darkModeState.next(false);
+ fixture.detectChanges();
+ expect(component.darkMode).toBeFalsy();
+
+ });
+
+ it('should refresh tables', async () => {
+ let refreshButton = await loader.getHarness(MatButtonHarness.with({ selector: '#refreshButton' }));
+
+ const jobsComponent: JobsListComponent = fixture.debugElement.query(By.directive(JobsListComponent)).componentInstance;
+ spyOn(jobsComponent, 'refreshDataClick');
+ spyOn(jobsComponent, 'clearFilter');
+
+ const prodsComponent: ProducersListComponent = fixture.debugElement.query(By.directive(ProducersListComponent)).componentInstance;
+ spyOn(prodsComponent, 'loadProducers');
+ spyOn(prodsComponent, 'clearFilter');
+
+ await refreshButton.click();
+
+ expect(jobsComponent.refreshDataClick).toHaveBeenCalled();
+ expect(jobsComponent.clearFilter).toHaveBeenCalled();
+ expect(prodsComponent.loadProducers).toHaveBeenCalled();
+ expect(prodsComponent.clearFilter).toHaveBeenCalled();
+
+ });
+ });