| 80 | describe('CanActivate', () => { |
| 81 | describe('guard completes before emitting a value', () => { |
| 82 | @Injectable({providedIn: 'root'}) |
| 83 | class CompletesBeforeEmitting { |
| 84 | private subject$ = new Subject<boolean>(); |
| 85 | |
| 86 | constructor(destroyRef: DestroyRef) { |
| 87 | destroyRef.onDestroy(() => this.subject$.complete()); |
| 88 | } |
| 89 | |
| 90 | // Note that this is a simple illustrative case of when an observable |
| 91 | // completes without emitting a value. In a real-world scenario, this |
| 92 | // might represent an HTTP request that never emits before the app is |
| 93 | // destroyed and then completes when the app is destroyed. |
| 94 | canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { |
| 95 | return this.subject$; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | it('should not thrown an unhandled promise rejection', async () => { |
| 100 | const router = TestBed.inject(Router); |
nothing calls this directly
no test coverage detected
searching dependent graphs…