jasmine-expect-count

1.1.2 • Public • Published

Actions Status

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-dev

then 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;
});

Readme

Keywords

Package Sidebar

Install

npm i jasmine-expect-count

Weekly Downloads

111

Version

1.1.2

License

MIT

Unpacked Size

13.7 kB

Total Files

12

Last publish

Collaborators

  • tonybrix