Closed toh82 closed 9 years ago
This looks well done, thank you! :)
I left a tiny comment in the test case.
Before this can be merged, it’d be great if you could squash your commits into a single commit with a message like: feat(clear): added clear() method
or something like that.
Thanks again! :)
@jan: the commits are like we do this with our other plugins / modules... it's the convention ;)
getting an error:
pouchdb-hoodie-api zoepage$ node tests
module.js:338
throw err;
^
Error: Cannot find module 'pouchdb/extras/promise'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/zoepage/Projekte/hood.ie/pouchdb-hoodie-api/tests/utils/wait-for.js:3:15)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
in pouchdb-hoodie-api/tests/utils/wait-for.js:3:15
we define the path to var Promise = require('pouchdb/extras/promise')
, but there seems something to be missing.
w00p, congrats to first Hoodie pull request! :tada: welcome to the family :)
Your test is not good yet though, I'll comment on the changes in a bit, but here's what you want:
test('removes existing db', function (t) {
t.plan(2)
var db = dbFactory()
var store = db.hoodieApi()
var localObj1 = {
_id: 'cleanTest',
cnt: 'cleanTest dummy doc'
}
store.on('clear', function () {
t.pass("store 'clear' event was triggered")
})
store.add(localObj1)
.then(function () {
return store.clear()
})
.then(function () {
return db.get('cleanTest')
})
.catch(function (error) {
t.equal(error.status, 404, 'doc removed after store.clear')
})
})
Sorry I've 3h of meetings ahead of me now, let me know if anything doesn't make sense
@gr2m makes sense so i updated the PR \o/ thy for checking @janl @zoepage i'm very happy/proud to help in this project
all right, this looks great! Now is the time to clean up commit messages, so we can merge it :) And I know this is very confusing with all the commit conventions at all, but we are working on making them more clear and document them on hood.ie.
But anyway, can you squash these commits into these 3?
test(clear): initial version
feat(clear): initial version
docs(README): clear method and event
Does that all make sense? I can also do the squashing for you, just let me know :)
merged via c7de9ea
closes #39