This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Observable, Observer } from 'rxjs'; | |
| export class UserAsyncService { | |
| user = { name: 'Mannie' }; | |
| getUserDetails() { | |
| // Create an observables. | |
| const userObservables = Observable.create( | |
| (observer: Observer<{ name: string }>) => { | |
| setTimeout(() => { | |
| observer.next(this.user); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { TestBed, tick, fakeAsync } from '@angular/core/testing'; | |
| import { UserAsyncComponent } from './user-async.component'; | |
| import { UserAsyncService } from './user-async.service'; | |
| import { Observable, Observer } from 'rxjs'; | |
| describe('User Async Component:', () => { | |
| beforeEach(async () => { | |
| TestBed.configureTestingModule({ | |
| declarations: [UserAsyncComponent] | |
| }); |
NewerOlder