mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #30785 from hirochachacha/mockingoose
@types/mockingoose: add new package
This commit is contained in:
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for mockingoose 2.11
|
||||
// Project: https://github.com/alonronin/mockingoose#readme
|
||||
// Definitions by: Hiroshi Ioka <https://github.com/hirochachacha>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
type Op =
|
||||
| 'find'
|
||||
| 'findOne'
|
||||
| 'count'
|
||||
| 'countDocuments'
|
||||
| 'estimatedDocumentCount'
|
||||
| 'distinct'
|
||||
| 'findOneAndUpdate'
|
||||
| 'findOneAndRemove'
|
||||
| 'remove'
|
||||
| 'update'
|
||||
| 'deleteOne'
|
||||
| 'deleteMany'
|
||||
| 'save';
|
||||
|
||||
declare class Mock {
|
||||
toReturn(expected: any, op?: Op): this;
|
||||
reset(op: Op): this;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
interface Target {
|
||||
__mocks: any;
|
||||
resetAll(): void;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
type Proxy = Target & {
|
||||
[index: string]: Mock;
|
||||
};
|
||||
|
||||
declare const mockingoose: Proxy;
|
||||
|
||||
export default mockingoose;
|
||||
@@ -0,0 +1,9 @@
|
||||
import mockingoose from 'mockingoose';
|
||||
|
||||
mockingoose.User
|
||||
.toReturn({ name: 'name' })
|
||||
.toReturn({ name: 'a name too' }, 'findOne')
|
||||
.toReturn({ name: 'another name' }, 'save')
|
||||
.reset('find');
|
||||
|
||||
mockingoose.resetAll();
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mockingoose-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user