Hello there,

I am an Angular newbie, and was going through the tutorial on the Angular 
site (https://docs.angularjs.org/tutorial/), and noticed that although the 
app seemed to be functioning properly, the code was failing the jasmine 
unit test. 

Here's what I'm getting in the log:

Chrome 35.0.1916 (Mac OS X 10.9.3): Executed 1 of 2 (1 FAILED) (0 secs / 
0.02 seChrome 35.0.1916 (Mac OS X 10.9.3) PhoneCat controllers 
PhoneListCtrl should set the default value of orderProp model FAILED

Error: [ng:areq] Argument 'PhoneListCtrl' is not a function, got undefined

Here's what's in my jasmine test file:

'use strict';

/* jasmine specs for controllers go here */

describe('PhoneCat controllers', function() {

 describe('PhoneListCtrl', function(){

    var scope, ctrl;

   beforeEach(module('phonecatApp'));

   beforeEach(inject(function($controller) {

      scope = {};

      ctrl = $controller('PhoneListCtrl', {$scope:scope});

    }));

   it('should create "phones" model with 3 phones', 
inject(function($controller) {

      expect(scope.phones.length).toBe(3);

    }));

  it('should set the default value of orderProp model', function() {

      expect(scope.orderProp).toBe('age');

    });

  });

});
And here's what's in my controller:
'use strict';

/* Controllers */

var phonecatApp = angular.module('phonecatApp', []);

phonecatApp.controller('PhoneListCtrl', function($scope) {
  $scope.phones = [
    {'name': 'Nexus S',
     'snippet': 'Fast just got faster with Nexus S.',
     'age': 1},
    {'name': 'Motorola XOOMâ„¢ with Wi-Fi',
     'snippet': 'The Next, Next Generation tablet.',
     'age': 2},
    {'name': 'MOTOROLA XOOMâ„¢',
     'snippet': 'The Next, Next Generation tablet.',
     'age': 3}
  ];

  $scope.orderProp = 'age';
});

Has anyone gone through the tutorial and had this same issue? 

Thanks!

Doron

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to