ts-sinon
- Version 2.0.2
- Published
- 11.2 kB
- 4 dependencies
- MIT license
Install
npm i ts-sinon
yarn add ts-sinon
pnpm add ts-sinon
Overview
sinon library extension to stub whole object and interfaces
Index
Functions
function stubConstructor
stubConstructor: <T extends new (...args: any[]) => any>( constructor: T, ...constructorArgs: ConstructorParameters<T> | undefined[]) => StubbedInstance<InstanceType<T>>;
function stubInterface
stubInterface: <T extends object>( methods?: ObjectMethodsMap<T>) => StubbedInstance<T>;
function stubObject
stubObject: <T extends object>( object: T, methods?: ObjectMethodsKeys<T> | ObjectMethodsMap<T>) => StubbedInstance<T>;
Type Aliases
type AllowedKeys
type AllowedKeys<T, Condition> = { [Key in keyof T]: T[Key] extends Condition ? Key : never;}[keyof T];
type ObjectMethodsKeys
type ObjectMethodsKeys<T> = AllowedKeys<T, (...args: any[]) => any>[];
type ObjectMethodsMap
type ObjectMethodsMap<T> = { [Key in keyof T]?: T[Key] extends (...args: any[]) => any ? ReturnType<T[Key]> : never;};
type StubbedInstance
type StubbedInstance<T> = sinon.SinonStubbedInstance<T> & T;
Package Files (1)
Dependencies (4)
Dev Dependencies (8)
Peer Dependencies (0)
No peer dependencies.
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/ts-sinon
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ts-sinon)
- HTML<a href="https://www.jsdocs.io/package/ts-sinon"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3269 ms. - Missing or incorrect documentation? Open an issue for this package.