Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

httpBackend's verify methods don't catch unexpected http calls #15855

Closed
@cmplank

Description

@cmplank

I'm submitting a ...

  • bug report
  • feature request
  • other (Please do not submit support requests here (see above))

Current behavior:
Starting in angular 1.6.0, when a unit test exercises an http call but doesn't specify an httpBackend expectation, neither the httpBackend.verifyNoOutstandingExpectation() nor the httpBackend.verifyNoOutstandingRequest() method throw an error. This problem still manifests in the latest snapshot.

Expected / new behavior:
Previously (on angular 1.5.11) each of the verify methods threw errors with the message "Unexpected request: GET No more request expected" when an http method was called without an accompanying expectation.

Minimal reproduction of the problem with instructions:
Write a unit test that exercises a $http call but don't tell httpBackend to expect it. Call httpBackend.verifyNoOutstandingExpectation() and httpBackend.verifyNoOutstandingRequest() and neither of them will throw an error and your test will pass.

Plunk on angular snapshot: http://plnkr.co/edit/DZZ2Nl?p=preview
Change the angular version to 1.5.11 and the test will pass.

Angular version: 1.6.3
This is an issue in 1.6.0 through the most recent snapshot of angular. An interesting note is that it is not the version of angular-mocks that makes the difference as I would have expected, but rather the version of core angular.

Browser: [all]
Happens in node/karma/jasmine tests and in Chrome jasmine runner (see plunk)

Anything else:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions