Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: mocking toReturn via function * Update build * Update babel (needed because of async/await) * Undo unnecessary changes * Uniformize spaces * Fix distinct * Update build * Update readme * feat: mockModel + typescript conversion * Add test for Model * README update * Allow older mongoose * Convert tests to async * Reformat file * Refactoring * Strong type return value * Rebuild lib * Leave documentation * Update docs * Update README * Update lib * Update README * Remove obsolete dependency * Fix issue with jest mocks * Add prettier and allow mockingoose(Model) * Readme, linting fix * Remove mockModel from exports * Run linting in CI * CI lint fix * Remove comment * Reformat README * Fresh build * Add recent changes to readme
- Loading branch information
1 parent
dda1e44
commit 7158b0a
Showing
21 changed files
with
1,990 additions
and
3,610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as mongoose from 'mongoose'; | ||
import { Schema } from 'mongoose'; | ||
|
||
export interface IUser extends mongoose.Document { | ||
name: string; | ||
email: string; | ||
created: Date; | ||
saveCount: number; | ||
} | ||
|
||
const schema = new Schema({ | ||
created: { type: Date, default: Date.now }, | ||
email: { type: String, required: true }, | ||
name: String, | ||
saveCount: { type: Number, default: 0 }, | ||
}); | ||
|
||
schema.pre('save', function() { | ||
(this as any).saveCount++; | ||
}); | ||
|
||
const User = mongoose.model<IUser>('User', schema); | ||
|
||
export default User; |
Oops, something went wrong.