From 20e0b5d081256fcb781b87a5da9f7f8e63f4a02d Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Mon, 6 Nov 2017 17:08:01 +0100 Subject: [PATCH] Tests fixed --- .../app/shared/guards/unset-app.guard.spec.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Squidex/app/shared/guards/unset-app.guard.spec.ts b/src/Squidex/app/shared/guards/unset-app.guard.spec.ts index f31d720b8..9a9508277 100644 --- a/src/Squidex/app/shared/guards/unset-app.guard.spec.ts +++ b/src/Squidex/app/shared/guards/unset-app.guard.spec.ts @@ -6,6 +6,7 @@ */ import { IMock, Mock, Times } from 'typemoq'; +import { Observable } from 'rxjs'; import { AppsStoreService } from 'shared'; @@ -19,10 +20,20 @@ describe('UnsetAppGuard', () => { }); it('should unselect app', () => { + appStoreService.setup(x => x.selectApp(null)) + .returns(() => Observable.of(false)); + const guard = new UnsetAppGuard(appStoreService.object); - expect(guard.canActivate({}, {})).toBeTruthy(); + let result: boolean = undefined; + guard.canActivate(null, null) + .subscribe(value => { + result = value; + }); + + expect(result).toBeTruthy(); + appStoreService.verify(x => x.selectApp(null), Times.once()); }); }); \ No newline at end of file