2

I get that error since my app.config file is included in my tests. It makes all my unit tests involving httpbackend fail. They usually look like this:

beforeEach(function(){
  module('consumerApp');
  inject(function($injector) {
    httpBackend = $injector.get('$httpBackend');
  });
});

describe('foo', function(){
  it('does something', inject(function(Foo){
    httpBackend.when("POST", URL).respond(json);

    Foo.something();
    httpBackend.flush();
    expect(Foo.stuff).toEqual('done');
  }));
});

I am not sure why the unit tests need to call my templates to run...

Alex C
  • 1,334
  • 2
  • 18
  • 41
  • 1
    How does your app.config look like? – Ye Liu Sep 11 '14 at 19:45
  • 2
    You have to find where does this GET request come from, and if this is an intended behavior (dynamic loading) handle it in your tests by setting `httpBackend.expectGET('layouts/index.html');` (before the action) and `httpBackend.flush();` (after the action) – glepretre Sep 12 '14 at 07:14
  • Did you found a solution for your problem? – Svilen Sep 16 '14 at 01:32
  • No I removed the config.js file from my unit test files for now. – Alex C Sep 16 '14 at 15:26

0 Answers0