-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Error:
Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:nomod] Module 'app' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
karma.confi.js:
in files I added all reference files file to load module(app).
Spec.js
describe("create request test", function () {
var RequestService;
var inputRequest;
var RequestProvider;
var messageService;
var appConstants
var controller;
var scope;
var q;
var location;
var window;
var state;
var modal;
beforeEach(module("app"));
beforeEach(inject(function ($rootScope, $controller, $injector, $q,$location,$window,$state,$modal) {
RequestService = $injector.get("RequestService");
inputRequest = $injector.get("inputRequest");
RequestProvider = $injector.get("RequestProvider");
messageService = $injector.get("messageService");
appConstants = $injector.get("appConstants");
scope = $rootScope.$new;
controller = $controller("createRequestController", {
$scope : scope,
$q:q,
$location :location,
$window :window,
$state :state,
$modal : modal
});
}));
it("controller should exist", function () {
expect(controller).not.toBe(undefined);
});
it("controller call commentIndex method ", function () {
expect(scope.commentIndex).toBeNull();
});
});
controller.js:
app.controller("createRequestController", [ '$scope', "$rootScope", "$q","$location", "$window", "$state","RequestService","inputRequest","RequestProvider","messageService","$modal","appConstants",
function($scope, $rootScope, $q, $location, $window, $state,RequestService,inputRequest,RequestProvider,messageService,$modal,appConstants) {
$scope.appConstants = appConstants;
$scope.commentIndex='';
app.js:
var app = MyApp = angular.module("MyApp", [ "ui.router", "ui.bootstrap",
"ngRoute" ,"agGrid","ui.select","ngTextTruncate","infinite-scroll","ngDragDrop","ngSanitize"]);