Merge pull request #30785 from hirochachacha/mockingoose

@types/mockingoose: add new package
This commit is contained in:
Andrew Casey
2018-12-05 18:14:24 -08:00
committed by GitHub
4 changed files with 73 additions and 0 deletions
+40
View File
@@ -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;
+9
View File
@@ -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();
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }