Refactor WatchersPanelController test

pull/3860/head
Alex Dik 9 years ago
parent 2003acf274
commit 173b19af5a
  1. 33
      frontend/app/components/panels/controllers/watchers-panel.controller.test.js

@ -26,18 +26,8 @@
// See doc/COPYRIGHT.rdoc for more details.
// ++
/*jshint expr: true*/
describe('WatchersPanelController', function() {
'use strict';
beforeEach(angular.mock.module('openproject.workPackages.controllers'));
var $controller, $rootScope;
beforeEach(inject(['$controller', '$rootScope', function(ctrl, root) {
$controller = ctrl;
$rootScope = root;
}]));
var $controller, $rootScope, locals;
var workPackage = {
links: {
@ -54,21 +44,22 @@ describe('WatchersPanelController', function() {
}
};
beforeEach(angular.mock.module('openproject.workPackages.controllers'));
it('should exist', function() {
var locals = {
$scope: $rootScope.$new()
};
locals.$scope.workPackage = workPackage;
expect($controller('WatchersPanelController', locals)).to.exist;
});
beforeEach(inject(['$controller', '$rootScope', function(ctrl, root) {
$controller = ctrl;
$rootScope = root;
it('should not work without a work workPackage', function() {
var locals = {
locals = {
$scope: $rootScope.$new()
};
}]));
it('should exist', function() {
expect($controller('WatchersPanelController', locals, { workPackage: workPackage })).to.exist;
});
it('should not work without a work workPackage', function() {
expect(function() {
$controller('WatchersPanelController', locals);
}).to.throw;

Loading…
Cancel
Save