describe('Directive vnId', () => { let $scope; let $element; let compile; beforeEach(ngModule('vnCore')); compile = _element => { inject(($compile, $rootScope) => { $scope = $rootScope.$new(); $element = angular.element(_element); $compile($element)($scope); $scope.$digest(); }); }; it(`should throw an error when there's no id defined`, () => { let html = `
`; expect(() => { compile(html); }).toThrow(new Error(`vnId: Attribute can't be null`)); }); it(`should set the controller into the $scope as there are no errors being thrown`, () => { let html = ``; compile(html); expect($scope.myId).toBeDefined(); }); });