Update unit tests
This commit is contained in:
parent
ef82918191
commit
a638ec445e
@ -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('<a>{{ notifications }}</a>');
|
||||
}));
|
||||
|
||||
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('<navbar></navbar>')($rootScope);
|
||||
$httpBackend.flush();
|
||||
$rootScope.notifications = 44;
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(element.text()).toBe('44');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -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('<li></li>');
|
||||
}));
|
||||
|
||||
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('<sidebar></sidebar>')($rootScope);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(element.html()).toBe('<li></li>');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -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('<th>Current Health</th>');
|
||||
}));
|
||||
|
||||
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("<currenthealth></currenthealth>")($rootScope);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(element.text()).toBe('Current Health');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -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('<td>{{ problems }}</td>');
|
||||
}));
|
||||
|
||||
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('<statusoverview></statusoverview>')($rootScope);
|
||||
$httpBackend.flush();
|
||||
$rootScope.problems = 31;
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(element.text()).toBe('31');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -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('<td>{{ problems }}</td>');
|
||||
}));
|
||||
|
||||
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('<topalertproducers></topalertproducers>')($rootScope);
|
||||
$httpBackend.flush();
|
||||
$rootScope.problems = 31;
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(element.text()).toBe('31');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user