Skip to content

Instantly share code, notes, and snippets.

@tehvicke
Created February 14, 2020 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tehvicke/71f06546e1992d5d3d0e6d4df9d5ad91 to your computer and use it in GitHub Desktop.
Save tehvicke/71f06546e1992d5d3d0e6d4df9d5ad91 to your computer and use it in GitHub Desktop.
Test to validate that we can update an object in the database
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