About 48 results
Open links in new tab
  1. Sinon.JS - Standalone test fakes, spies, stubs and mocks for JavaScript ...

    You’ve seen the most common tasks people tackle with Sinon.JS, yet we’ve only scratched the surface. View more quick examples below, or dive into the API docs, which also provides useful pointers on …

  2. API documentation - Sinon.JS

    API documentation - Sinon.JS - v20.0.0 This page contains the entire Sinon.JS API documentation along with brief introductions to the concepts Sinon implements.

  3. Stubs - Sinon.JS

    When constructing the Promise, sinon uses the Promise.resolve method. You are responsible for providing a polyfill in environments which do not provide Promise.

  4. Spies - Sinon.JS

    Can be used for partial matching, Sinon only checks the provided arguments against actual arguments, so a call that received the provided arguments (in the same spots) and possibly others as well will …

  5. Releases - Sinon.JS

    Their addressing schemes vary, but an example url such as https://cdn.jsdelivr.net/npm/sinon@3/pkg/sinon.js would download the latest browser bundle of Sinon 3.

  6. Matchers - Sinon.JS

    Custom matchers are created with the sinon.match factory which takes a test function and an optional message. The test function takes a value as the only argument, returns true if the value matches the …

  7. Mocks - Sinon.JS

    Typical usage: sinon.mock(jQuery).expects("ajax").atLeast(2).atMost(5); jQuery.ajax.verify(); var expectation = sinon.expectation.create([methodName]); Creates an expectation without a mock …

  8. Assertions - Sinon.JS

    Sinon.JS ships with a set of assertions that mirror most behavior verification methods and properties on spies and stubs. The advantage of using the assertions is that failed expectations on stubs and spies …

  9. Spy call - Sinon.JS

    This behaves the same as spyCall.notCalledWith(sinon.match(arg1), sinon.match(arg2), ...). spyCall.returned(value); Returns true if spied function returned the provided value on this call. Uses …

  10. Fakes - Sinon.JS

    In Sinon, a fake is a Function that records arguments, return value, the value of this and exception thrown (if any) for all of its calls. A fake is immutable: once created, the behavior will not change.