How to use the pouchdb-browser.removeMock.mockImplementationOnce function in pouchdb-browser

To help you get started, we’ve selected a few pouchdb-browser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ArkEcosystem / desktop-wallet / __tests__ / unit / store / db / interface.spec.js View on Github external
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)
      })
    })