Skip to content

Commit

Permalink
Make MainController tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
msabramo committed Jul 10, 2016
1 parent 1c69917 commit 080109e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/main-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* # MainController
* Controller of the docker-registry-frontend
*/
angular.module('main-controller', [])
angular.module('main-controller', ['ngRoute', 'app-version-services', 'registry-host-services'])
.controller('MainController', ['$scope', '$route', '$routeParams', '$location', 'AppVersion', 'RegistryHost',
function($scope, $route, $routeParams, $location, AppVersion, RegistryHost){
this.$route = $route;
this.$location = $location;
this.$routeParams = $routeParams;
$scope.appVersion = AppVersion.query();
$scope.registryHost = RegistryHost.query();
}]);
}]);
21 changes: 9 additions & 12 deletions test/spec/controllers/main.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
'use strict';

describe('Controller: MainCtrl', function () {
describe('MainController', function() {

// load the controller's module
beforeEach(module('dockerRegistryFrontendApp'));
beforeEach(module('main-controller'));

var MainCtrl,
scope;
var ctrl;
var scope = {};

// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
MainCtrl = $controller('MainCtrl', {
$scope: scope
});
beforeEach(inject(function($controller) {
ctrl = $controller('MainController', {$scope: scope});
}));

it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
it('should attach an appVersion and registryHost to the scope', function() {
var scope_keys = Object.keys(scope).sort();
expect(scope_keys).toEqual(['appVersion', 'registryHost']);
});
});

0 comments on commit 080109e

Please sign in to comment.