Use spy objects.
This commit is contained in:
		
							parent
							
								
									77c4d5831d
								
							
						
					
					
						commit
						e7bdbfa849
					
				
					 1 changed files with 6 additions and 16 deletions
				
			
		|  | @ -4,32 +4,22 @@ import {FormsModule} from '@angular/forms'; | |||
| import {InputComponentManagerService} from './input-component-manager.service'; | ||||
| import {Step} from './step'; | ||||
| import {ConverterRegistryService} from './converter-registry.service'; | ||||
| import {Converter} from './converter/converter'; | ||||
| import {VersionComponent} from './version/version.component'; | ||||
| import createSpyObj = jasmine.createSpyObj; | ||||
| 
 | ||||
| describe('AppComponent', () => { | ||||
|   let sut: AppComponent; | ||||
|   let fixture: ComponentFixture<AppComponent>; | ||||
|   const firstStep: Step = new Step(0); | ||||
| 
 | ||||
|   const inputComponentManagerServiceStub = { | ||||
|     getFirst: () => { | ||||
|       return firstStep; | ||||
|     } | ||||
|   }; | ||||
|   const inputComponentManagerServiceStub = createSpyObj(['getFirst']); | ||||
|   inputComponentManagerServiceStub.getFirst.and.returnValue(firstStep); | ||||
| 
 | ||||
|   const converterRegistryServiceStub = { | ||||
|     getAllConverters: (): Converter[] => { | ||||
|       return []; | ||||
|     }, | ||||
| 
 | ||||
|     getConverter: (id: string): Converter => { | ||||
|       return undefined; | ||||
|     } | ||||
|   }; | ||||
|   const converterRegistryServiceStub = createSpyObj(['getAllConverters', 'getConverter']); | ||||
|   converterRegistryServiceStub.getAllConverters.and.returnValue([]); | ||||
|   converterRegistryServiceStub.getConverter.and.returnValue(undefined); | ||||
| 
 | ||||
|   beforeEach(async(() => { | ||||
|     /*return */ | ||||
|     TestBed.configureTestingModule({ | ||||
|       declarations: [AppComponent, VersionComponent], | ||||
|       imports: [FormsModule], | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue