Explicitly declare dependencies in tests

This commit is contained in:
Joe Fiorini
2015-02-09 10:28:01 -05:00
parent c35826c696
commit f72cfd38df
3 changed files with 18 additions and 18 deletions

View File

@@ -7,12 +7,12 @@ describe('Job Status Graph Directive', function() {
beforeEach(module('Tower')); beforeEach(module('Tower'));
beforeEach(module(function($provide) { beforeEach(module(['$provide', function($provide) {
$provide.value('LoadBasePaths', angular.noop); $provide.value('LoadBasePaths', angular.noop);
$provide.value('adjustGraphSize', resizeHandler); $provide.value('adjustGraphSize', resizeHandler);
})); }]));
beforeEach(inject(function($rootScope, $compile, $httpBackend) { beforeEach(inject(['$rootScope', '$compile', '$httpBackend', function($rootScope, $compile, $httpBackend) {
httpBackend = $httpBackend; httpBackend = $httpBackend;
$httpBackend.expectGET('/static/js/local_config.js').respond({ $httpBackend.expectGET('/static/js/local_config.js').respond({
}); });
@@ -38,7 +38,7 @@ describe('Job Status Graph Directive', function() {
$httpBackend.flush(); $httpBackend.flush();
})); }]));
afterEach(function() { afterEach(function() {
element.trigger('$destroy'); element.trigger('$destroy');

View File

@@ -12,9 +12,9 @@ describe('Host Count Graph Data Service', function() {
function flushPromises() { function flushPromises() {
window.setTimeout(function() { window.setTimeout(function() {
inject(function($rootScope) { inject(['$rootScope', function($rootScope) {
$rootScope.$apply(); $rootScope.$apply();
}, 1000); }], 1000);
}); });
} }
@@ -70,20 +70,20 @@ describe('Host Count Graph Data Service', function() {
beforeEach(module("Tower")); beforeEach(module("Tower"));
beforeEach(module(function($provide) { beforeEach(module(['$provide', function($provide) {
$provide.value("$cookieStore", { get: angular.noop }); $provide.value("$cookieStore", { get: angular.noop });
$provide.value('ProcessErrors', processErrors); $provide.value('ProcessErrors', processErrors);
$provide.value('Rest', restStub); $provide.value('Rest', restStub);
$provide.value('GetBasePath', getBasePath); $provide.value('GetBasePath', getBasePath);
})); }]));
afterEach(function() { afterEach(function() {
restStub.reset(); restStub.reset();
}); });
beforeEach(inject(function(_hostCountGraphData_, $httpBackend, $q, $rootScope, $timeout) { beforeEach(inject(['hostCountGraphData', '$httpBackend', '$q', '$rootScope', '$timeout', function(_hostCountGraphData_, $httpBackend, $q, $rootScope, $timeout) {
hostCountGraphData = _hostCountGraphData_; hostCountGraphData = _hostCountGraphData_;
httpBackend = $httpBackend; httpBackend = $httpBackend;
rootScope = $rootScope; rootScope = $rootScope;
@@ -91,7 +91,7 @@ describe('Host Count Graph Data Service', function() {
$httpBackend.expectGET('/static/js/local_config.js').respond({ $httpBackend.expectGET('/static/js/local_config.js').respond({
}); });
q = $q; q = $q;
})); }]));
it('returns a promise to be fulfilled when data comes in', function() { it('returns a promise to be fulfilled when data comes in', function() {
var license = "license"; var license = "license";

View File

@@ -16,9 +16,9 @@ describe('Job Status Graph Data Service', function() {
function flushPromises() { function flushPromises() {
window.setTimeout(function() { window.setTimeout(function() {
inject(function($rootScope) { inject(['$rootScope', function($rootScope) {
$rootScope.$apply(); $rootScope.$apply();
}); }]);
}); });
} }
@@ -44,20 +44,20 @@ describe('Job Status Graph Data Service', function() {
beforeEach(module("Tower")); beforeEach(module("Tower"));
beforeEach(module(function($provide) { beforeEach(module(['$provide', function($provide) {
$provide.value("$cookieStore", { get: angular.noop }); $provide.value("$cookieStore", { get: angular.noop });
$provide.value('ProcessErrors', processErrors); $provide.value('ProcessErrors', processErrors);
$provide.value('Rest', restStub); $provide.value('Rest', restStub);
$provide.value('GetBasePath', getBasePath); $provide.value('GetBasePath', getBasePath);
})); }]));
afterEach(function() { afterEach(function() {
restStub.reset(); restStub.reset();
}); });
beforeEach(inject(function(_jobStatusGraphData_, $httpBackend, $q, $rootScope, $timeout) { beforeEach(inject(['jobStatusGraphData', '$httpBackend', '$q', '$rootScope', '$timeout', function(_jobStatusGraphData_, $httpBackend, $q, $rootScope, $timeout) {
jobStatusGraphData = _jobStatusGraphData_; jobStatusGraphData = _jobStatusGraphData_;
httpBackend = $httpBackend; httpBackend = $httpBackend;
rootScope = $rootScope; rootScope = $rootScope;
@@ -65,7 +65,7 @@ describe('Job Status Graph Data Service', function() {
$httpBackend.expectGET('/static/js/local_config.js').respond({ $httpBackend.expectGET('/static/js/local_config.js').respond({
}); });
q = $q; q = $q;
})); }]));
it('returns a promise to be fulfilled when data comes in', function() { it('returns a promise to be fulfilled when data comes in', function() {
var firstResult = "result"; var firstResult = "result";
@@ -101,14 +101,14 @@ describe('Job Status Graph Data Service', function() {
var result = q.defer(); var result = q.defer();
jobStatusGraphData.setupWatcher(); jobStatusGraphData.setupWatcher();
inject(function($rootScope) { inject(['$rootScope', function($rootScope) {
$rootScope.$on('DataReceived:JobStatusGraph', function(e, data) { $rootScope.$on('DataReceived:JobStatusGraph', function(e, data) {
result.resolve(data); result.resolve(data);
}); });
$rootScope.$emit('JobStatusChange'); $rootScope.$emit('JobStatusChange');
restStub.succeed({ data: expected }); restStub.succeed({ data: expected });
flushPromises(); flushPromises();
}); }]);
return expect(result.promise).to.eventually.equal(expected); return expect(result.promise).to.eventually.equal(expected);
}); });