jest-mock-extended
- Version 4.0.0-beta1
- Published
- 79.9 kB
- 1 dependency
- MIT license
Install
npm i jest-mock-extended
yarn add jest-mock-extended
pnpm add jest-mock-extended
Overview
Type safe mocking extensions for jest
Index
Variables
Functions
Classes
Interfaces
Type Aliases
Variables
variable any
const any: MatcherCreator<any, any>;
variable anyArray
const anyArray: MatcherCreator<any[], any[]>;
variable anyBoolean
const anyBoolean: MatcherCreator<boolean, boolean>;
variable anyFunction
const anyFunction: MatcherCreator<Function, Function>;
variable anyMap
const anyMap: MatcherCreator<Map<any, any>, Map<any, any>>;
variable anyNumber
const anyNumber: MatcherCreator<number, number>;
variable anyObject
const anyObject: MatcherCreator<any, any>;
variable anySet
const anySet: MatcherCreator<Set<any>, Set<any>>;
variable anyString
const anyString: MatcherCreator<string, string>;
variable anySymbol
const anySymbol: MatcherCreator<Symbol, Symbol>;
variable arrayIncludes
const arrayIncludes: MatcherCreator<any[], any>;
variable isA
const isA: MatcherCreator<any, any>;
variable JestMockExtended
const JestMockExtended: { DEFAULT_CONFIG: GlobalConfig; configure: (config: GlobalConfig) => void; resetConfig: () => void;};
variable mapHas
const mapHas: MatcherCreator<Map<any, any>, any>;
variable notEmpty
const notEmpty: MatcherCreator<any, any>;
variable notNull
const notNull: MatcherCreator<any, any>;
variable notUndefined
const notUndefined: MatcherCreator<any, any>;
variable objectContainsKey
const objectContainsKey: MatcherCreator<any, string>;
variable objectContainsValue
const objectContainsValue: MatcherCreator<any, any>;
variable setHas
const setHas: MatcherCreator<Set<any>, any>;
Functions
function calledWithFn
calledWithFn: <T extends any>({ fallbackMockImplementation,}?: { fallbackMockImplementation?: T;}) => CalledWithMock<T>;
function captor
captor: <T extends unknown = any>() => CaptorMatcher<T>;
function matches
matches: <T extends unknown = any>(matcher: MatcherFn<T>) => Matcher<T>;
function mock
mock: <T, MockedReturn extends _MockProxy<T> & T = _MockProxy<T> & T>( mockImplementation?: any, opts?: import('./Mock').MockOpts | undefined) => MockedReturn;
function mockClear
mockClear: (mock: MockProxy<any>) => any;
function mockDeep
mockDeep: { <T>( opts: { funcPropSupport?: true; fallbackMockImplementation?: MockOpts['fallbackMockImplementation']; }, mockImplementation?: DeepPartial<T> ): DeepMockProxyWithFuncPropSupport<T>; <T>(mockImplementation?: DeepPartial<T>): DeepMockProxy<T>;};
function mockFn
mockFn: <T extends FunctionLike>() => CalledWithMock<T> & T;
function mockReset
mockReset: (mock: MockProxy<any>) => any;
function stub
stub: <T extends object>() => T;
Classes
class CaptorMatcher
class CaptorMatcher<T> {}
constructor
constructor();
property $$typeof
$$typeof: Symbol;
property asymmetricMatch
readonly asymmetricMatch: MatcherFn<T>;
property value
readonly value: {};
property values
readonly values: T[];
method getExpectedType
getExpectedType: () => string;
method toAsymmetricMatcher
toAsymmetricMatcher: () => string;
method toString
toString: () => string;
class Matcher
class Matcher<T> implements MatcherLike<T> {}
constructor
constructor(asymmetricMatch: MatcherFn<T>, description: string);
property $$typeof
$$typeof: Symbol;
property asymmetricMatch
readonly asymmetricMatch: MatcherFn<T>;
property inverse
inverse?: boolean;
method getExpectedType
getExpectedType: () => string;
method toAsymmetricMatcher
toAsymmetricMatcher: () => string;
method toString
toString: () => string;
Interfaces
interface CalledWithMock
interface CalledWithMock<T extends FunctionLike> extends jest.Mock<T> {}
property calledWith
calledWith: (...args: [...MatchersOrLiterals<Parameters<T>>]) => jest.Mock<T>;
interface GlobalConfig
interface GlobalConfig {}
property ignoreProps
ignoreProps?: ProxiedProperty[];
interface MatcherCreator
interface MatcherCreator<T, E = T> {}
call signature
(expectedValue?: E): Matcher<T>;
interface MatcherLike
interface MatcherLike<T> {}
method asymmetricMatch
asymmetricMatch: (other: unknown) => boolean;
method getExpectedType
getExpectedType: () => string;
method toAsymmetricMatcher
toAsymmetricMatcher: () => string;
method toString
toString: () => string;
Type Aliases
type DeepMockProxy
type DeepMockProxy<T> = _DeepMockProxy<T> & T;
type MatcherFn
type MatcherFn<T> = (actualValue: T) => boolean;
type MatchersOrLiterals
type MatchersOrLiterals<Y extends any[]> = { [K in keyof Y]: MatcherLike<Y[K]> | Y[K];};
type MockProxy
type MockProxy<T> = _MockProxy<T> & T;
Package Files (3)
Dependencies (1)
Dev Dependencies (6)
Peer Dependencies (3)
Badge
To add a badge like this oneto 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/jest-mock-extended
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/jest-mock-extended)
- HTML<a href="https://www.jsdocs.io/package/jest-mock-extended"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2570 ms. - Missing or incorrect documentation? Open an issue for this package.