-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99eb606
commit 1b7e4a0
Showing
5 changed files
with
76 additions
and
5 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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
const mongoose = require('mongoose') | ||
const jwt = require('jsonwebtoken') | ||
const User = require('../../src/models/user') | ||
const Task = require('../../src/models/task') | ||
|
||
const userOneId = new mongoose.Types.ObjectId() | ||
const userOne = { | ||
|
@@ -13,13 +14,56 @@ const userOne = { | |
}] | ||
} | ||
|
||
const userTwoId = new mongoose.Types.ObjectId() | ||
const userTwo = { | ||
_id: userTwoId, | ||
name: 'Pranjal', | ||
email: '[email protected]', | ||
password: 'FakePass_-', | ||
tokens: [{ | ||
token: jwt.sign({ _id: userTwoId }, process.env.JWT_SECRET) | ||
}] | ||
} | ||
|
||
const taskOne = { | ||
_id: new mongoose.Types.ObjectId(), | ||
description: 'Dummy Task 1', | ||
completed: true, | ||
owner: userOneId | ||
} | ||
|
||
const taskTwo = { | ||
_id: new mongoose.Types.ObjectId(), | ||
description: 'Dummy Task 2', | ||
completed: false, | ||
owner: userTwoId | ||
} | ||
|
||
const taskThree = { | ||
_id: new mongoose.Types.ObjectId(), | ||
description: 'Dummy Task 3', | ||
completed: false, | ||
owner: userOneId | ||
} | ||
|
||
|
||
const setupDatabase = async () => { | ||
await User.deleteMany() | ||
await Task.deleteMany() | ||
await new User(userOne).save() | ||
await new User(userTwo).save() | ||
await new Task(taskOne).save() | ||
await new Task(taskTwo).save() | ||
await new Task(taskThree).save() | ||
} | ||
|
||
module.exports = { | ||
userOneId, | ||
userOne, | ||
userTwoId, | ||
userTwo, | ||
taskOne, | ||
taskTwo, | ||
taskThree, | ||
setupDatabase | ||
} |
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