UNPKG

generator-yaas-builder-module

Version:
55 lines (43 loc) 2.09 kB
describe('DemoCtrl Test', function () { var $scope, $rootScope, $controller, $translate, demoSvc, mockedNotificationSvc, demoCtrl; //*********************************************************************** // Common Setup // - shared setup between constructor validation and method validation //*********************************************************************** // configure the target controller's module for testing - see angular.mock beforeEach(angular.mock.module('ds.shared')); beforeEach(angular.mock.module('ui.router')); beforeEach(angular.mock.module('ds.demo')); beforeEach(inject(function (_$rootScope_, _$controller_, $injector, _DemoSvc_, _$translate_) { this.addMatchers({ toEqualData: function (expected) { return angular.equals(this.actual, expected); } }); $rootScope = _$rootScope_; $scope = _$rootScope_.$new(); $controller = _$controller_; $translate = _$translate_; demoSvc = _DemoSvc_; mockedNotificationSvc = { showError: jasmine.createSpy('NotificationSvc.showError'), showSuccess: jasmine.createSpy('NotificationSvc.showSuccess'), showWarning: jasmine.createSpy('NotificationSvc.showWarning') }; })); var moduleName = 'Demo module'; var moduleDescription = 'Demo module description'; describe('Initialization', function () { beforeEach(function () { demoCtrl = $controller('DemoCtrl', { $scope: $scope, 'moduleName': moduleName, 'moduleDescription': moduleDescription, 'NotificationSvc': mockedNotificationSvc, '$translate': $translate }); }); it('should assign module name and module description to $scope', function () { expect($scope.moduleName).toEqual(moduleName); expect($scope.moduleDescription).toEqual(moduleDescription); }); }); });