test(aio): add mock services
This commit is contained in:
		
							parent
							
								
									b7e76cc2e1
								
							
						
					
					
						commit
						b44bc9c022
					
				
							
								
								
									
										8
									
								
								aio/src/testing/location.service.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								aio/src/testing/location.service.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | ||||||
|  | 
 | ||||||
|  | export class MockLocationService { | ||||||
|  |   urlSubject = new BehaviorSubject<string>(this.initialUrl); | ||||||
|  |   currentUrl = this.urlSubject.asObservable(); | ||||||
|  |   constructor(private initialUrl) {} | ||||||
|  | } | ||||||
|  | 
 | ||||||
							
								
								
									
										23
									
								
								aio/src/testing/logger.service.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								aio/src/testing/logger.service.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | import { Injectable } from '@angular/core'; | ||||||
|  | 
 | ||||||
|  | @Injectable() | ||||||
|  | export class MockLogger { | ||||||
|  | 
 | ||||||
|  |   output = { | ||||||
|  |     log: [], | ||||||
|  |     error: [], | ||||||
|  |     warn: [] | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   log(value: any, ...rest) { | ||||||
|  |     this.output.log.push([value, ...rest]); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   error(value: any, ...rest) { | ||||||
|  |     this.output.error.push([value, ...rest]); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   warn(value: any, ...rest) { | ||||||
|  |     this.output.warn.push([value, ...rest]); | ||||||
|  |   } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user