I have a test like this for an angular application:
it("should return false if all products loaded", function () { $httpBackend.flush(); scope.loadNextProducts(15).then(function (isThereMoreToLoad) { expect(isThereMoreToLoad).toBe(false); }); scope.$apply(); });
If I forgot to write the broadcast $httpBackend.flush(); or scope.$apply(); , then the test will never reach the expect() , and the test will succeed.
Is there a way to ensure that the expect () jasmine test runs, and if not, should it fail?
Something like telling it() how much expect() expect, or tell jasmine that every test must run at least one expect() , otherwise it should fail.
source share