diff --git a/app/navbar/navbar_test.js b/app/navbar/navbar_test.js
index 078072a..7523696 100644
--- a/app/navbar/navbar_test.js
+++ b/app/navbar/navbar_test.js
@@ -1,18 +1,43 @@
'use strict';
describe('Navbar module', function () {
+ var $compile,
+ $rootScope,
+ $controller,
+ $httpBackend;
beforeEach(module('adagios.navbar'));
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$controller_, _$httpBackend_) {
+ $compile = _$compile_;
+ $rootScope = _$rootScope_;
+ $controller = _$controller_;
+ $httpBackend = _$httpBackend_;
+
+ $httpBackend.expectGET('navbar/navbar.html').respond('{{ notifications }}');
+ }));
+
describe('NavBarCtrl', function () {
- it('should be defined', inject(function ($controller) {
- var scope, ctrl;
- scope = {};
- ctrl = $controller('NavBarCtrl', { $scope : scope });
+ it('should be defined', function () {
+ var scope = $rootScope.$new(),
+ navbar = $controller('NavBarCtrl', { $scope : scopeĀ });
- expect(ctrl).toBeDefined();
- }));
+ expect(navbar).toBeDefined();
+ });
+
+ });
+
+ describe('Navbar directive', function () {
+
+ it('should insert the number of warnings', function () {
+ var element = $compile('')($rootScope);
+ $httpBackend.flush();
+ $rootScope.notifications = 44;
+ $rootScope.$digest();
+
+ expect(element.text()).toBe('44');
+ });
});
});
diff --git a/app/sidebar/sidebar_test.js b/app/sidebar/sidebar_test.js
index 90c5293..ca3c19e 100644
--- a/app/sidebar/sidebar_test.js
+++ b/app/sidebar/sidebar_test.js
@@ -1,18 +1,41 @@
'use strict';
describe('Sidebar module', function () {
+ var $compile,
+ $rootScope,
+ $controller,
+ $httpBackend;
beforeEach(module('adagios.sidebar'));
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$controller_, _$httpBackend_) {
+ $compile = _$compile_;
+ $rootScope = _$rootScope_;
+ $controller = _$controller_;
+ $httpBackend = _$httpBackend_;
+
+ $httpBackend.expectGET('sidebar/sidebar.html').respond('
');
+ }));
+
describe('SideBarCtrl', function () {
- it('should be defined', inject(function ($controller) {
- var scope, ctrl;
- scope = {};
- ctrl = $controller('SideBarCtrl', { $scope : scope });
+ it('should be defined', function () {
+ var scope = $rootScope.$new(),
+ ctrl = $controller('SideBarCtrl', { $scope : scope });
expect(ctrl).toBeDefined();
- }));
+ });
+
+ });
+
+ describe('Sidebar directive', function () {
+
+ it('should send a GET request', function () {
+ var element = $compile('')($rootScope);
+ $httpBackend.flush();
+
+ expect(element.html()).toBe('');
+ });
});
});
diff --git a/app/tactical/current_health/current_health_test.js b/app/tactical/current_health/current_health_test.js
index f717900..fe1ffb3 100644
--- a/app/tactical/current_health/current_health_test.js
+++ b/app/tactical/current_health/current_health_test.js
@@ -1,18 +1,43 @@
'use strict';
describe('Current Health tactical submodule', function () {
+ var $compile,
+ $rootScope,
+ $controller,
+ $httpBackend;
beforeEach(module('adagios.tactical.current_health'));
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$controller_, _$httpBackend_) {
+ $compile = _$compile_;
+ $rootScope = _$rootScope_;
+ $controller = _$controller_;
+ $httpBackend = _$httpBackend_;
+
+ $httpBackend.expectGET('tactical/current_health/current_health.html')
+ .respond('Current Health | ');
+ }));
+
describe('TacticalCurrentHealth', function () {
- it('should be defined', inject(function ($controller) {
+ it('should be defined', function () {
var scope, ctrl;
scope = {};
ctrl = $controller('TacticalCurrentHealth', { $scope : scope });
expect(ctrl).toBeDefined();
- }));
+ });
+
+ });
+
+ describe('Current health directive', function () {
+
+ it('should send a GET request', function () {
+ var element = $compile("")($rootScope);
+ $httpBackend.flush();
+
+ expect(element.text()).toBe('Current Health');
+ });
});
});
diff --git a/app/tactical/status_overview/status_overview_test.js b/app/tactical/status_overview/status_overview_test.js
index 031d7ff..6ae4f6e 100644
--- a/app/tactical/status_overview/status_overview_test.js
+++ b/app/tactical/status_overview/status_overview_test.js
@@ -1,18 +1,45 @@
'use strict';
describe('Status Overview tactical submodule', function () {
+ var $compile,
+ $rootScope,
+ $controller,
+ $httpBackend;
beforeEach(module('adagios.tactical.status_overview'));
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$controller_, _$httpBackend_) {
+ $compile = _$compile_;
+ $rootScope = _$rootScope_;
+ $controller = _$controller_;
+ $httpBackend = _$httpBackend_;
+
+ $httpBackend.expectGET('tactical/status_overview/status_overview.html')
+ .respond('{{ problems }} | ');
+ }));
+
describe('TacticalStatusOverViewCtrl', function () {
- it('should be defined', inject(function ($controller) {
+ it('should be defined', function () {
var scope, ctrl;
scope = {};
ctrl = $controller('TacticalStatusOverViewCtrl', { $scope : scope });
expect(ctrl).toBeDefined();
- }));
+ });
+
+ });
+
+ describe('Status overview directive', function () {
+
+ it('should insert the number of warnings', function () {
+ var element = $compile('')($rootScope);
+ $httpBackend.flush();
+ $rootScope.problems = 31;
+ $rootScope.$digest();
+
+ expect(element.text()).toBe('31');
+ });
});
});
diff --git a/app/tactical/top_alert_producers/top_alert_producers_test.js b/app/tactical/top_alert_producers/top_alert_producers_test.js
index 4cbcf54..97a6b64 100644
--- a/app/tactical/top_alert_producers/top_alert_producers_test.js
+++ b/app/tactical/top_alert_producers/top_alert_producers_test.js
@@ -1,18 +1,45 @@
'use strict';
describe('Top Alert Producer tactical submodule', function () {
+ var $compile,
+ $rootScope,
+ $controller,
+ $httpBackend;
beforeEach(module('adagios.tactical.top_alert_producers'));
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$controller_, _$httpBackend_) {
+ $compile = _$compile_;
+ $rootScope = _$rootScope_;
+ $controller = _$controller_;
+ $httpBackend = _$httpBackend_;
+
+ $httpBackend.expectGET('tactical/top_alert_producers/top_alert_producers.html')
+ .respond('{{ problems }} | ');
+ }));
+
describe('TacticalTopAlertProducers', function () {
- it('should be defined', inject(function ($controller) {
+ it('should be defined', function () {
var scope, ctrl;
scope = {};
ctrl = $controller('TacticalTopAlertProducers', { $scope : scope });
expect(ctrl).toBeDefined();
- }));
+ });
+
+ });
+
+ describe('Status overview directive', function () {
+
+ it('should insert the number of warnings', function () {
+ var element = $compile('')($rootScope);
+ $httpBackend.flush();
+ $rootScope.problems = 31;
+ $rootScope.$digest();
+
+ expect(element.text()).toBe('31');
+ });
});
});