hoodiehq / hoodie-client

:dog: Client API for the Hoodie server
Apache License 2.0
34 stars 25 forks source link

Call reset instead of clear on signout #52

Closed NickColley closed 8 years ago

NickColley commented 8 years ago

closes #44

Out of curiosity why does hoodie.account.id change on signout?

NickColley commented 8 years ago

Needs a review on the tests, the mocking seems a little suspect to me.

HipsterBrown commented 8 years ago

So this has tests to check that store.reset is called during signIn and signOut, correct? I'm also not following the hoodie mock passed into init.

gr2m commented 8 years ago

Out of curiosity why does hoodie.account.id change on signout?

hoodie.account.id gets set immediately on first page load, even before you sign up for an account. So when you sign out, it’s as if you’d load hoodie for the first time: you get a new user account id. The main reason for this is that we want to allow users to create data even before signing up for an account, and store their user id in createdBy properties of all objects stored

gr2m commented 8 years ago

we mock the hoodie api for the init unit test to avoid any side effects, as it’s just a unit test, and ideally you pass in only the bits the respective unit test needs.

hoodie-client is kinda hard to test, and we still figure out how to do the implementation best, but for now the init test is better than nothing :)

HipsterBrown commented 8 years ago

Looks good to me. :+1:

gr2m commented 8 years ago

looks great, thanks @nickcolley