M
M
Maks Burkov2017-04-14 18:03:44
Angular
Maks Burkov, 2017-04-14 18:03:44

ReferenceError: describe is not defined, what is missing in my case?

When I run the test, I get a ReferenceError: describe is not defined , what could be the problem with
this project structure?

describe('PhoneListController', function() {
    beforeEach(module('phonecatApp'));
    it('should create a `phones` model with 3 phones', inject(function($controller) {
        var scope = {};
        var ctrl = $controller('PhoneListController', {$scope: scope});

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

var phoneCatApp = angular.module('phoneCatApp',[]);
phoneCatApp.controller("PhoneListController",function PhoneListController($scope) {
    $scope.phones = [ // that way i adding property to the object in mine case the scope!
        {name:'Nexus S',snippet:'Fast just got faster with Nexus S.'},
        {name:'Motorola XOOM™ with Wi-Fi',snippet:'The Next, Next Generation tablet.'},
        {name:'MOTOROLA XOOM™',snippet:'The Next, Next Generation tablet.'}
    ];
});

<!DOCTYPE html>
    <html lang="en" ng-app="phoneCatApp">
    <head>
        <meta charset="UTF-8">
        <title>PhoneCat</title>
        <link rel="stylesheet" href="../css/index.css">
        <script src="../../lib/angular.min.js"></script>
        <script src="../../lib/karma.conf.js"></script>
        <script src="../../controllers/controller.js"></script>
        <script src="../../tests/phoneCatAppTests.js"></script>
    </head>

    <body ng-controller="PhoneListController">

    <ul>
        <li ng-repeat="phone in phones">
            <span>{{phone.name}}</span>
                <p>
                {{phone.snippet}}
                </p>
        </li>
    </ul>
    </body>
    </html>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question