Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should delete the Model as a document', async () => {
const _rev = 'rev-last'
const updatedDoc = Object.assign(doc, { _rev })
getMock.mockImplementationOnce(id => {
return id === model.id ? updatedDoc : null
})
removeMock.mockImplementationOnce(docToRemove => {
return { ok: _.isEqual(docToRemove, updatedDoc) }
})
const result = await db.delete(model)
expect(result).toBeTruthy()
expect(getMock).toHaveBeenCalledWith(model.id)
expect(removeMock).toHaveBeenCalledWith(doc)
})
})