Created
February 14, 2020 12:22
-
-
Save tehvicke/71f06546e1992d5d3d0e6d4df9d5ad91 to your computer and use it in GitHub Desktop.
Test to validate that we can update an object in the database
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
it('can update likes on a thought', async () => { | |
const thought = await new Thought({ message: 'test message' }).save() | |
const fetchedThought = await Thought.findOneAndUpdate( | |
{ _id: thought._id }, | |
{ $inc: { hearts: 1 } }, | |
{ new: true } | |
) | |
expect(fetchedThought.hearts).toEqual(1) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment