hoodiehq / pouchdb-hoodie-api

:dog: Hoodie-like API for PouchDB
https://hoodiehq.github.io/pouchdb-hoodie-api
Apache License 2.0
44 stars 11 forks source link

Retest .clear #99

Open NickColley opened 8 years ago

NickColley commented 8 years ago

We've got a skipped .clear test that was blocked on the fact that PouchDB does not reinitilize the database, but now downstream we've worked around this with a .reset method in https://github.com/hoodiehq/hoodie-client-store

What's the plan of action to fix this test? Some options:

gr2m commented 8 years ago

I would re-initialise the PouchDB db instance in .clear() as we do with .reset() in https://github.com/hoodiehq/hoodie-client-store.

A problem I see is that we expose the db instance at store.db which will be replaced on clear, but we can add that information to the README with a "use at your own risk" note

gr2m commented 8 years ago

strike that, I think we should no re-initialse anything on .clear(), instead do what PouchDB itself does: become unusable :) so the user has to create another instance manually if they want to add data again

NickColley commented 8 years ago

Could we rename clear to destroy to better reflect what's going on? That conflicts with PouchDB's api though, is it necessary to have the events firing for this use case?

gr2m commented 8 years ago

yeah I don’t mind renaming that method to .destroy(), and renaming the clear event, too. We still need a clear event in https://github.com/hoodiehq/hoodie-client-store, but that is out of scope here