-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 39: add clear method #50
Conversation
) | ||
|
||
.catch(function (err) { | ||
t.ok(err instanceof Error, 'rejects error') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fourth test assertion, you only plan 3 above.
This code is likely not being run ever, so we might want to remove it.
Since this is the catch()
for db.get()
, which we are not testing here, we don’t have to worry about testing an error case.
If this code needs a catch()
to run issue free, I’d just remove the t.ok
assertion.
(note that this is the first time I’m reviewing code in this part of the Hoodie world, so maybe get a second opinion from @zoepage or @gr2m :)
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: Thanks again! :) |
@jan: the commits are like we do this with our other plugins / modules... it's the convention ;) |
getting an error:
in |
w00p, congrats to first Hoodie pull request! 🎉 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 |
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?
Does that all make sense? I can also do the squashing for you, just let me know :) |
4ed9dcb
to
d4663e9
Compare
d4663e9
to
3754bd1
Compare
merged via c7de9ea |
closes #39