diff --git a/awx/ui/client/tests/adhoc/adhoc.controller-test.js b/awx/ui/client/tests/adhoc/adhoc.controller-test.js index a91f9cc1b8..c60af03f44 100644 --- a/awx/ui/client/tests/adhoc/adhoc.controller-test.js +++ b/awx/ui/client/tests/adhoc/adhoc.controller-test.js @@ -4,13 +4,13 @@ import adhocModule from 'adhoc/main'; import RestStub from '../support/rest-stub'; describe("adhoc.controller", function() { - var $scope, $rootScope, $location, $routeParams, + var $scope, $rootScope, $location, $stateParams, $stateExtender, CheckPasswords, PromptForPasswords, CreateLaunchDialog, AdhocForm, GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices, KindChange, LookUpInit, CredentialList, Empty, Wait; var $controller, ctrl, generateFormCallback, waitCallback, locationCallback, - getBasePath, processErrorsCallback, restCallback; + getBasePath, processErrorsCallback, restCallback, stateExtenderCallback; beforeEach("instantiate the adhoc module", function() { angular.mock.module(adhocModule.name); @@ -29,6 +29,9 @@ describe("adhoc.controller", function() { }; processErrorsCallback = sinon.spy(); restCallback = new RestStub(); + stateExtenderCallback = { + addState: angular.noop + } }); beforeEach("mock dependencies", angular.mock.module(['$provide', function(_provide_) { @@ -50,6 +53,8 @@ describe("adhoc.controller", function() { $provide.value('CredentialList', angular.noop); $provide.value('Empty', angular.noop); $provide.value('Wait', waitCallback); + $provide.value('$stateExtender', stateExtenderCallback); + $provide.value('$stateParams', angular.noop); }])); beforeEach("put $q in scope", window.inject(['$q', function($q) { @@ -128,34 +133,6 @@ describe("adhoc.controller", function() { }); }); - describe("getInventoryNameForBreadcrumbs", function() { - it('should set the inventory name on scope', function() { - var req = ctrl.privateFn.getInventoryNameForBreadcrumbs("foo"); - var response = { data: { name: "foo" } }; - - restCallback.succeed(response); - restCallback.flush(); - - return req.then(function() { - expect($scope.inv_name).to.equal('foo'); - }); - }); - - it('should navigate to the inventory manage page when the inventory ' + - 'can not be found', function() { - var req = ctrl.privateFn.getInventoryNameForBreadcrumbs("foo"); - var response = { "detail": "Not found", status: "bad" }; - - restCallback.fail(response); - restCallback.flush(); - - return req.catch(function() { - expect(processErrorsCallback).to.have.been.called; - expect(locationCallback.path).to.have.been.calledWith("/inventories/"); - }); - }); - }); - describe("instantiateArgumentHelp", function() { it("should initially provide a canned argument help response", function() { expect($scope.argsPopOver).to.equal('
These arguments are used ' + diff --git a/awx/ui/client/tests/support/node/index.js b/awx/ui/client/tests/support/node/index.js index 21d5639eb5..a664b449b5 100644 --- a/awx/ui/client/tests/support/node/index.js +++ b/awx/ui/client/tests/support/node/index.js @@ -24,5 +24,6 @@ require('./setup/lodash'); require('./setup/local-storage'); require('./setup/moment'); + require('./setup/angular-ui-router'); })(); diff --git a/awx/ui/client/tests/support/node/setup/angular-ui-router.js b/awx/ui/client/tests/support/node/setup/angular-ui-router.js new file mode 100644 index 0000000000..f36250ee27 --- /dev/null +++ b/awx/ui/client/tests/support/node/setup/angular-ui-router.js @@ -0,0 +1 @@ +require('angular-ui-router');