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.

It's not obvious that tests with promises must call $rootScope.$apply() #1915

Closed
@inklesspen

Description

@inklesspen

I just spent a few hours pulling my hair out because my tests weren't passing and I couldn't figure out why. It turns out it's because $q's promises don't actually get resolved during tests unless you call $rootScope.$apply. (This appears to have been masked in my earlier testing because I was testing services that used $timeout and $httpBackend and their flush methods.)

Please make sure to document this behavior when you improve the testing documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions