ts-mockito

  • Version 2.6.1
  • Published
  • 131 kB
  • 1 dependency
  • MIT license

Install

npm i ts-mockito
yarn add ts-mockito
pnpm add ts-mockito

Overview

Mocking library for TypeScript

Index

Variables

variable _default

const _default: {
spy: typeof spy;
mock: typeof mock;
verify: typeof verify;
when: typeof when;
instance: typeof instance;
capture: typeof capture;
reset: typeof reset;
resetCalls: typeof resetCalls;
anyOfClass: typeof anyOfClass;
anyFunction: typeof anyFunction;
anyNumber: typeof anyNumber;
anyString: typeof anyString;
anything: typeof anything;
between: typeof between;
deepEqual: typeof deepEqual;
notNull: typeof notNull;
strictEqual: typeof strictEqual;
match: typeof match;
objectContaining: typeof objectContaining;
};

    Functions

    function anyFunction

    anyFunction: () => any;

      function anyNumber

      anyNumber: () => any;

        function anyOfClass

        anyOfClass: <T>(expectedClass: new (...args: any[]) => T) => any;

          function anyString

          anyString: () => any;

            function anything

            anything: () => any;

              function between

              between: (min: number, max: number) => any;

                function capture

                capture: {
                <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
                method: (
                a: T0,
                b: T1,
                c: T2,
                d: T3,
                e: T4,
                f: T5,
                g: T6,
                h: T7,
                i: T8,
                j: T9
                ) => any
                ): ArgCaptor10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>;
                <T0, T1, T2, T3, T4, T5, T6, T7, T8>(
                method: (
                a: T0,
                b: T1,
                c: T2,
                d: T3,
                e: T4,
                f: T5,
                g: T6,
                h: T7,
                i: T8
                ) => any
                ): ArgCaptor9<T0, T1, T2, T3, T4, T5, T6, T7, T8>;
                <T0, T1, T2, T3, T4, T5, T6, T7>(
                method: (a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7) => any
                ): ArgCaptor8<T0, T1, T2, T3, T4, T5, T6, T7>;
                <T0, T1, T2, T3, T4, T5, T6>(
                method: (a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6) => any
                ): ArgCaptor7<T0, T1, T2, T3, T4, T5, T6>;
                <T0, T1, T2, T3, T4, T5>(
                method: (a: T0, b: T1, c: T2, d: T3, e: T4, f: T5) => any
                ): ArgCaptor6<T0, T1, T2, T3, T4, T5>;
                <T0, T1, T2, T3, T4>(
                method: (a: T0, b: T1, c: T2, d: T3, e: T4) => any
                ): ArgCaptor5<T0, T1, T2, T3, T4>;
                <T0, T1, T2, T3>(method: (a: T0, b: T1, c: T2, d: T3) => any): ArgCaptor4<
                T0,
                T1,
                T2,
                T3
                >;
                <T0, T1, T2>(method: (a: T0, b: T1, c: T2) => any): ArgCaptor3<T0, T1, T2>;
                <T0, T1>(method: (a: T0, b: T1) => any): ArgCaptor2<T0, T1>;
                <T0>(method: (a: T0) => any): ArgCaptor1<T0>;
                };

                  function deepEqual

                  deepEqual: <T>(expectedValue: T) => T;

                    function instance

                    instance: <T>(mockedValue: T) => T;

                      function match

                      match: (expectedValue: RegExp | string) => any;

                        function mock

                        mock: {
                        <T>(clazz: (new (...args: any[]) => T) | (Function & { prototype: T })): T;
                        <T>(clazz?: any): T;
                        };

                          function notNull

                          notNull: () => any;

                            function objectContaining

                            objectContaining: (expectedValue: Object) => any;

                              function reset

                              reset: <T>(...mockedValues: T[]) => void;

                                function resetCalls

                                resetCalls: <T>(...mockedValues: T[]) => void;

                                  function spy

                                  spy: <T>(instanceToSpy: T) => T;

                                    function strictEqual

                                    strictEqual: (expectedValue: any) => any;

                                      function verify

                                      verify: <T>(method: T) => MethodStubVerificator<T>;

                                        function when

                                        when: {
                                        <T>(method: Promise<T>): MethodStubSetter<Promise<T>, T, Error>;
                                        <T>(method: T): MethodStubSetter<T, void, Error>;
                                        };

                                          Package Files (1)

                                          Dependencies (1)

                                          Dev Dependencies (21)

                                          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/ts-mockito.

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