LEFT | RIGHT |
(no file at all) | |
1 import { async, ComponentFixture, discardPeriodicTasks, fakeAsync, TestBed, tick
} from '@angular/core/testing'; | 1 import { async, ComponentFixture, discardPeriodicTasks, fakeAsync, TestBed, tick
} from '@angular/core/testing'; |
2 import { MatDialog } from '@angular/material'; | 2 import { MatDialog } from '@angular/material'; |
3 import { By } from '@angular/platform-browser'; | 3 import { By } from '@angular/platform-browser'; |
4 import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | 4 import { NoopAnimationsModule } from '@angular/platform-browser/animations'; |
5 import { RouterTestingModule } from '@angular/router/testing'; | 5 import { RouterTestingModule } from '@angular/router/testing'; |
6 import { Observable } from 'rxjs/Observable'; | 6 import { Observable } from 'rxjs/Observable'; |
7 import { IntervalObservable } from 'rxjs/observable/IntervalObservable'; | 7 import { IntervalObservable } from 'rxjs/observable/IntervalObservable'; |
8 | 8 |
9 import { AngularMaterialImporterModule } from '../../angular-material-importer/a
ngular-material-importer.module'; | 9 import { AngularMaterialImporterModule } from '../../angular-material-importer/a
ngular-material-importer.module'; |
10 import { FAKE_HTTP_ERROR, MatDialogStub } from '../../util/common.test-util'; | 10 import { FAKE_HTTP_ERROR, MatDialogStub } from '../../util/common.test-util'; |
11 import { ErrorDialogComponent } from '../../util/error-dialog/error-dialog.compo
nent'; | 11 import { ErrorDialogComponent } from '../../util/error-dialog/error-dialog.compo
nent'; |
12 import { JobStatusPipe } from '../job-status/job-status.pipe'; | |
13 import { JobsService } from '../jobs.service'; | 12 import { JobsService } from '../jobs.service'; |
14 import { FAKE_TRANSFER_JOB_RESPONSE, JobsServiceStub } from '../jobs.test-util'; | 13 import { FAKE_TRANSFER_JOB_RESPONSE, JobsServiceStub } from '../jobs.test-util'; |
15 import { JobRunDetailsComponent } from './job-run-details.component'; | 14 import { JobRunDetailsComponent } from './job-run-details.component'; |
16 | 15 |
17 let jobsServiceStub: JobsServiceStub; | 16 let jobsServiceStub: JobsServiceStub; |
18 let matDialogStub: MatDialogStub; | 17 let matDialogStub: MatDialogStub; |
19 let intervalObservableCreateSpy: any; | 18 let intervalObservableCreateSpy: any; |
20 | 19 |
21 describe('JobRunDetailsComponent', () => { | 20 describe('JobRunDetailsComponent', () => { |
22 let component: JobRunDetailsComponent; | 21 let component: JobRunDetailsComponent; |
23 let fixture: ComponentFixture<JobRunDetailsComponent>; | 22 let fixture: ComponentFixture<JobRunDetailsComponent>; |
24 | 23 |
25 beforeEach(async(() => { | 24 beforeEach(async(() => { |
26 jobsServiceStub = new JobsServiceStub(); | 25 jobsServiceStub = new JobsServiceStub(); |
27 matDialogStub = new MatDialogStub(); | 26 matDialogStub = new MatDialogStub(); |
28 jobsServiceStub.getJob.and.returnValue(Observable.of(FAKE_TRANSFER_JOB_RESPO
NSE.transferJobs[0])); | 27 jobsServiceStub.getJob.and.returnValue(Observable.of(FAKE_TRANSFER_JOB_RESPO
NSE.transferJobs[0])); |
29 // Disable polling for most tests. | 28 // Disable polling for most tests. |
30 intervalObservableCreateSpy = spyOn(IntervalObservable, 'create').and.return
Value(Observable.never()); | 29 intervalObservableCreateSpy = spyOn(IntervalObservable, 'create').and.return
Value(Observable.never()); |
31 TestBed.configureTestingModule({ | 30 TestBed.configureTestingModule({ |
32 declarations: [ | 31 declarations: [ |
33 JobRunDetailsComponent, | 32 JobRunDetailsComponent, |
34 JobStatusPipe | |
35 ], | 33 ], |
36 providers: [ | 34 providers: [ |
37 {provide: JobsService, useValue: jobsServiceStub}, | 35 {provide: JobsService, useValue: jobsServiceStub}, |
38 {provide: MatDialog, useValue: matDialogStub} | 36 {provide: MatDialog, useValue: matDialogStub} |
39 ], | 37 ], |
40 imports: [ | 38 imports: [ |
41 NoopAnimationsModule, | 39 NoopAnimationsModule, |
42 AngularMaterialImporterModule, | 40 AngularMaterialImporterModule, |
43 RouterTestingModule | 41 RouterTestingModule |
44 ] | 42 ] |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 fixture = TestBed.createComponent(JobRunDetailsComponent); | 132 fixture = TestBed.createComponent(JobRunDetailsComponent); |
135 component = fixture.componentInstance; | 133 component = fixture.componentInstance; |
136 fixture.detectChanges(); | 134 fixture.detectChanges(); |
137 tick(10000); // Tick for long enough until the app makes a polling call. | 135 tick(10000); // Tick for long enough until the app makes a polling call. |
138 expect(matDialogStub.open).toHaveBeenCalled(); | 136 expect(matDialogStub.open).toHaveBeenCalled(); |
139 expect(matDialogStub.open.calls.mostRecent().args[0]).toBe(ErrorDialogCompon
ent); | 137 expect(matDialogStub.open.calls.mostRecent().args[0]).toBe(ErrorDialogCompon
ent); |
140 discardPeriodicTasks(); | 138 discardPeriodicTasks(); |
141 })); | 139 })); |
142 | 140 |
143 }); | 141 }); |
LEFT | RIGHT |