J
J
JIakki2016-07-27 23:53:20
Angular
JIakki, 2016-07-27 23:53:20

How to test sub modules using karma and mocks?

I have app module and app.chat submodule

angular
        .module('app', [
            'app.chat',
        ]);

I can get the app module through tests
beforeEach(function () {
    module('app')
  });

  beforeEach(inject(function($controller) {
    vm = $controller('IndexController', {$scope: {}});
  }));

But when I want to test app.chat, the inject just doesn't work.
beforeEach(function () {
    module('app.chat')
  });

  var vm;

  beforeEach(inject(function($controller) {
    vm = $controller('ChatController', {$scope: {}});
  }));

I will be glad to answer
thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2016-07-28
@healqq

Check the karma config, if the problem persists - show the config and the file where the app.chat module is initialized.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question