You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I my old unit tests i am using $httpBackend with .whenGET mocks.
beforeEach(() => {
inject(function ($injector, _$compile_, _$rootScope_) {
// The injector unwraps the underscores (_) from around the parameter names when matching
$compile = _$compile_;
$rootScope = _$rootScope_;
$httpBackend = $injector.get("$httpBackend");
});
$httpBackend.whenGET("api/langs/gb.json").respond({ "COMMON.HOME": homeName });
$httpBackend.whenGET("api/langs/de.json").respond({});
$httpBackend.whenGET(/^private\/auth\?.*/).respond({});
directiveElem = getCompiledElement();
});
Now i have included apiMock and my unit tests doesn't work any more.
it("should be defined and contiain first list item for home.", function () {
$httpBackend.flush();
expect(directiveElem).toBeDefined();
let olElement = directiveElem.find("ol");
expect(olElement).toBeDefined();
let homeElement = directiveElem.find("li");
expect(homeElement.html()).toContain(homeName);
});
I have tried
apiMockProvider.config({
disable: true
});
but it didn't help.
The text was updated successfully, but these errors were encountered:
Hmm odd, I use $httpBackend in our unit tests. The disable flag would still keep apiMock registered, just not run any logic. Still odd that it's breaking for you. What error are you seeing @juri33?
Your package is really helpful. Thank you guys.
I my old unit tests i am using $httpBackend with .whenGET mocks.
Now i have included apiMock and my unit tests doesn't work any more.
I have tried
but it didn't help.
The text was updated successfully, but these errors were encountered: