Skip to content
This repository has been archived by the owner on Sep 20, 2020. It is now read-only.

Error: [$injector:modulerr] Failed to instantiate module undefined due to: Error: [ng:areq] Argument 'fn' is not a function, got undefined #379

Open
shrutivirani opened this issue Apr 26, 2018 · 0 comments

Comments

@shrutivirani
Copy link

this both is controller ans test file of controller. i am running with "karma start --single-run" but it throws Error: [$injector:modulerr] Failed to instantiate module undefined due to: Error: [ng:areq] Argument 'fn' is not a function, got undefined
at bower_components/angular/angular.js:125:12
at bower_components/angular/angular.js:5034:15
at forEach (bower_components/angular/angular.js:418:20)
at loadModules (bower_components/angular/angular.js:4994:5)
at Object.createInjector [as injector] (bower_components/angular/angular.js:4911:19)
at UserContext.WorkFn (bower_components/angular-mocks/angular-mocks.js:3145:52)

controller.js

app.controller('dataEntryController',
['$cacheFactory', '$scope', 'productDataSvc', '$stateParams', '$state',
'$rootScope', '$controller', 'GridDataService', 'bentoComboDataService', 'bmJobQueue', '$translate', '$injector',
'$animate', '$q', '$timeout', 'AssociationService','errorAlertsFactory', 'dataEntryConfigService', 'bentoComboViewCacheService',
function ($cacheFactory, $scope, productDataSvc, $stateParams, $state,
$rootScope, $controller, GridDataService, bentoComboDataService, bmJobQueue, $translate, $injector,
$animate, $q, $timeout, AssociationService, errorAlertsFactory, dataEntryConfigService, bentoComboViewCacheService)
{
////////////////////////////////////////
/// initialization
////////////////////////////////////////
//$scope.debug = true;
//$scope.debugWantPollingMessages = true;
$scope.isLoaderBusyDE = true;
$scope.onInshUpdate000 = false;
$scope.doInshUpdate000 = false;
$scope.pollingSuspended = false;
$scope.unitsBeingAdded = new Set();
$scope.setBentoComboboxData = false;
$scope.deferredPromisesToDestroy = [];
$scope.previouslyHadData = $scope.currentlyHasData = false;
...............
............
.........
}

controller_test.js

var $cacheFactory, $scope, productDataSvc, $stateParams, $state,$rootScope, $controller, GridDataService, bentoComboDataService, bmJobQueue, $translate, $injector, $animate, $q, $timeout, AssociationService, errorAlertsFactory, dataEntryConfigService, bentoComboViewCacheService;

beforeEach(inject(function (_$cacheFactory_, _productDataSvc_, _$stateParams_, _$state_,
    _$rootScope_, _$controller_, _GridDataService_, _bentoComboDataService_, _bmJobQueue_, _$translate_, _$injector_, _$animate_, _$q_, _$timeout_, _AssociationService_, _errorAlertsFactory_, _dataEntryConfigService_, _bentoComboViewCacheService_) {
       $scope: $rootScope.$new();
       dataEntryConfigService = _dataEntryConfigService_;
       $cacheFactory = $cacheFactory,
        productDataSvc = productDataSvc,
        $stateParams = $stateParams,
        $state = $state,
        $rootScope = $rootScope,
        GridDataService = GridDataService,
        bentoComboDataService = bentoComboDataService,
        bmJobQueue = bmJobQueue,
        $translate = $translate,
        $animate = $animate,
        $q = $q,
        $timeout = $timeout,
        AssociationService = AssociationService,
        errorAlertsFactory = errorAlertsFactory,
        bentoComboViewCacheService = bentoComboViewCacheService
        $controller = _$controller_('dataEntryController', {

    });
}));

describe("data entry controller", function () {

    it("should be created successfully", function () {
        expect("hello").toBe("hello");
    });
});

});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant