1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 13:55:31 +03:00

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

View File

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

View File

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