1.1.2 • Published 5 years ago
jasmine-expect-count v1.1.2
Jasmine Expect Count
Lets you specify the number of expects expected to be called.
Installing
Save jasmine-expect-count in devDependencies
npm install jasmine-expect-count --save-devthen require it
require("jasmine-expect-count");before your tests.
Using
Jasmine Expect Count allows you to specify the number of expects to be called in an it.
it("should call expect 3 times", function () {
  jasmine.expectCount(3);
  expect(1).toBe(1);
  const p = new Promise(function (resolve) {
    setTimeout(function () {
      expect(2).toBe(2);
      resolve();
    }, 1);
  });
  expect(3).toBe(3);
  // if returning p is forgotten only 2 expects will be called.
  return p;
});