@types/sinon-chai

  • Version 3.2.12
  • Published
  • 6.53 kB
  • 2 dependencies
  • MIT license

Install

npm i @types/sinon-chai
yarn add @types/sinon-chai
pnpm add @types/sinon-chai

Overview

TypeScript definitions for sinon-chai

Index

Variables

variable sinonChai

const sinonChai: Chai.ChaiPlugin;

    Namespaces

    namespace global

    namespace global {}

      namespace global.Chai

      namespace global.Chai {}

        interface Assertion

        interface Assertion {}

          property called

          called: Assertion;
          • true if the spy was called at least once.

          property calledOnce

          calledOnce: Assertion;
          • true if the spy was called exactly once.

          property calledThrice

          calledThrice: Assertion;
          • true if the spy was called exactly thrice.

          property calledTwice

          calledTwice: Assertion;
          • true if the spy was called exactly twice.

          property calledWithNew

          calledWithNew: Assertion;
          • Returns true if spy/stub was called with the new operator. Beware that this is inferred based on the value of the this object and the spy function's prototype, so it may give false positives if you actively return the right kind of object.

          method callCount

          callCount: (count: number) => Assertion;
          • Parameter count

            The number of recorded calls.

          method calledAfter

          calledAfter: (
          anotherSpy: Sinon.SinonSpy | Sinon.SinonSpyCall | Sinon.SinonStub
          ) => Assertion;
          • Returns true if the spy was called after anotherSpy.

          method calledBefore

          calledBefore: (
          anotherSpy: Sinon.SinonSpy | Sinon.SinonSpyCall | Sinon.SinonStub
          ) => Assertion;
          • Returns true if the spy was called before anotherSpy.

          method calledImmediatelyAfter

          calledImmediatelyAfter: (
          anotherSpy: Sinon.SinonSpy | Sinon.SinonStub
          ) => Assertion;
          • Returns true if spy was called after anotherSpy, and no spy calls occurred between anotherSpy and spy.

          method calledImmediatelyBefore

          calledImmediatelyBefore: (
          anotherSpy: Sinon.SinonSpy | Sinon.SinonStub
          ) => Assertion;
          • Returns true if spy was called before anotherSpy, and no spy calls occurred between spy and anotherSpy.

          method calledOn

          calledOn: (context: any) => Assertion;
          • Returns true if context was this for this call.

          method calledOnceWith

          calledOnceWith: (...args: any[]) => Assertion;
          • Returns true if spy was called at exactly once with the provided arguments.

          method calledOnceWithExactly

          calledOnceWithExactly: (...args: any[]) => Assertion;
          • Returns true if spy was called exactly once with the provided arguments and no others.

          method calledWith

          calledWith: (...args: any[]) => Assertion;
          • Returns true if call received provided arguments (and possibly others).

          method calledWithExactly

          calledWithExactly: (...args: any[]) => Assertion;
          • Returns true if call received provided arguments and no others.

          method calledWithMatch

          calledWithMatch: (...args: any[]) => Assertion;
          • Returns true if call received matching arguments (and possibly others). This behaves the same as spyCall.calledWith(sinon.match(arg1), sinon.match(arg2), ...).

          method returned

          returned: (obj: any) => Assertion;
          • Returns true if spy returned the provided value at least once. Uses deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) for strict comparison (see matchers).

          method thrown

          thrown: (obj?: Error | typeof Error | string) => Assertion;
          • Returns true if spy threw the provided exception object at least once.

          interface LanguageChains

          interface LanguageChains {}

            property always

            always: Assertion;

              Package Files (1)

              Dependencies (2)

              Dev Dependencies (0)

              No dev dependencies.

              Peer Dependencies (0)

              No peer dependencies.

              Badge

              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/sinon-chai.

              • Markdown
                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/sinon-chai)
              • HTML
                <a href="https://www.jsdocs.io/package/@types/sinon-chai"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>