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
test: admin.signOut() throws error when signed out #113
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var store = require('humble-localstorage') | ||
var test = require('tape') | ||
|
||
var Account = require('../../index') | ||
|
||
var baseURL = 'http://localhost:3000' | ||
|
||
test('sign out without being signed in', function (t) { | ||
t.plan(2) | ||
|
||
// simulate user who has not yet signed in | ||
store.clear() | ||
store.setObject('account', {}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When simulating a user who is not signed in, Is it sufficient to set the account object to an empty object literal, or should there be more items in the object? From the code, it seems that having a session object inside of the account object implies that the user is logged in, so I wouldn't want to add a session object, but I didn't know if any other information is necessary in the account object to simulate a user who is not signed in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the |
||
|
||
var account = new Account({ | ||
url: baseURL, | ||
id: 'abc4567' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This question ties in with my last one. Should I remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. id represents the account id here. It’s an optional argument, you can see it described in the README: https://github.com/hoodiehq/hoodie-account-client#constructor |
||
}) | ||
|
||
account.signOut().catch(function (error) { | ||
t.is(typeof error, 'object', 'rejects with error object') | ||
t.equal( | ||
error.message, | ||
'UnauthenticatedError: Not signed in', | ||
'error not an UnauthenticatedError' | ||
) | ||
}) | ||
}) |
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.
looks good to me 👍