UNPKG

generator-ngfs

Version:

Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node

29 lines (23 loc) 837 B
'use strict'; describe('Controller: <%= classedName %>Ctrl', function () { // load the controller's module beforeEach(module('<%= scriptAppName %>')); var <%= classedName %>Ctrl, scope, $httpBackend; // Initialize the controller and a mock scope beforeEach(inject(function (_$httpBackend_, $controller, $rootScope) { $httpBackend = _$httpBackend_; $httpBackend.expectGET('/api/awesomeThings') .respond(['HTML5 Boilerplate', 'AngularJS', 'Karma', 'Express']); scope = $rootScope.$new(); <%= classedName %>Ctrl = $controller('<%= classedName %>Ctrl', { $scope: scope }); })); it('should attach a list of awesomeThings to the scope', function () { expect(scope.awesomeThings).toBeUndefined(); $httpBackend.flush(); expect(scope.awesomeThings.length).toBe(4); }); });