Added logout
Change-Id: If09690e089976244ded58a27b1f35a3a850ae2d1
diff --git a/src/app/core/nav/nav.spec.ts b/src/app/core/nav/nav.spec.ts
index 6a70f4c..3c18e4d 100644
--- a/src/app/core/nav/nav.spec.ts
+++ b/src/app/core/nav/nav.spec.ts
@@ -18,12 +18,17 @@
this.query = () => baseRoutes;
};
+const AuthMock = {
+ logout: jasmine.createSpy('logout')
+};
+
describe('Nav component', () => {
beforeEach(() => {
angular
.module('xosNav', ['app/core/nav/nav.html', 'ui.router'])
.component('xosNav', xosNav)
- .service('NavigationService', NavigationService);
+ .service('NavigationService', NavigationService)
+ .value('AuthService', AuthMock);
angular.mock.module('xosNav');
});
@@ -54,4 +59,13 @@
const childRouteContainer = $('.nav-second li', element);
expect(childRouteContainer.length).toBe(1);
});
+
+ it('should call the logout method', () => {
+ // NOTE upgrade to test the ng-click binding
+ // const btn = $(element).find('.nav-info .btn-block');
+ // btn.click();
+ // scope.$digest();
+ isolatedScope.vm.logout();
+ expect(AuthMock.logout).toHaveBeenCalled();
+ });
});