0

私の仕様:

describe('ScheduleController', function() {
    var ScheduleController, scope, spies = {};

    beforeEach(function() {
      module('mapApp');

      return inject(function($injector) {
        var $controller, $rootScope;
        $rootScope = $injector.get('$rootScope');
        $controller = $injector.get('$controller');

        scope = $rootScope.$new()

        $controller('ScheduleController', {
            $scope: scope
        });

        spies.buildScheduleUrl = spyOn(scope, 'buildScheduleUrl').and.callThrough();
      });
    });

    it('should build a schedule url', function() {
        expect(spies.buildScheduleUrl).toHaveBeenCalled();
    });
});

私のコントローラー:

window.map.controller('ScheduleController', ['$scope', '$window', 'cache', 'scheduleCache', 'dosingCache', 'patientCache', '$modal', 'util',
    function ($scope, $window, cache, scheduleCache, dosingCache, patientCache, $modal, util) {
        // other stuff here


        $scope.buildScheduleUrl();

    }

]);

したがって、私のbuildScheduleUrl関数は呼び出されないようです。私は何を間違っていますか?

4

1 に答える 1