| 
									
										
										
										
											2016-04-14 10:36:38 -07:00
										 |  |  | import { HEROES }         from './mock-heroes'; | 
					
						
							|  |  |  | import { Hero }           from './hero'; | 
					
						
							|  |  |  | import { HeroService }    from './hero.service'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-27 11:28:22 -07:00
										 |  |  | export { Hero }           from './hero'; | 
					
						
							|  |  |  | export { HeroService }    from './hero.service'; | 
					
						
							| 
									
										
										
										
											2016-04-14 10:36:38 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class MockHeroService implements HeroService { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     mockHeroes = HEROES.slice(); | 
					
						
							|  |  |  |     lastPromise: Promise<any>;  // so we can spy on promise calls
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     getHero(id: number) { | 
					
						
							| 
									
										
										
										
											2016-04-27 11:28:22 -07:00
										 |  |  |       return this.lastPromise = Promise.resolve(this.mockHeroes[0]); | 
					
						
							| 
									
										
										
										
											2016-04-14 10:36:38 -07:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     getHeroes() { | 
					
						
							| 
									
										
										
										
											2016-04-27 11:28:22 -07:00
										 |  |  |       return this.lastPromise = Promise.resolve<Hero[]>(this.mockHeroes); | 
					
						
							| 
									
										
										
										
											2016-04-14 10:36:38 -07:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     getHeroesSlowly() { return this.getHeroes(); } | 
					
						
							|  |  |  | } |