-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: resolve .signIn() and .signOut() with .profile
- Loading branch information
Showing
11 changed files
with
45 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ test('destroy account', function (t) { | |
}) | ||
|
||
nock(baseURL) | ||
.put('/session') | ||
.put('/session?include=account.profile') | ||
.reply(201, signInResponse) | ||
.delete('/session/account') | ||
.reply(204) | ||
|
@@ -46,13 +46,15 @@ test('destroy account', function (t) { | |
t.deepEqual(signOutHandler.lastCall.arg, { | ||
id: 'abc4567', | ||
username: '[email protected]', | ||
session: { id: 'sessionid123' } | ||
session: { id: 'sessionid123' }, | ||
profile: { favoriteClothing: 'Hoodie', fullName: 'Docs Chicken' } | ||
}, '"signout" event emitted with account object') | ||
|
||
t.deepEqual(destroyHandler.lastCall.arg, { | ||
id: 'abc4567', | ||
username: '[email protected]', | ||
session: { id: 'sessionid123' } | ||
session: { id: 'sessionid123' }, | ||
profile: { favoriteClothing: 'Hoodie', fullName: 'Docs Chicken' } | ||
}, '"destroy" event emitted with account object') | ||
|
||
t.is(signOutHandler.callCount, 1, '"signout" event emitted once') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ test('events', function (t) { | |
nock(baseURL) | ||
.put('/session/account') | ||
.reply(201, signUpResponse) | ||
.put('/session').thrice() | ||
.put('/session?include=account.profile').thrice() | ||
.reply(201, signInResponse) | ||
.patch('/session/account') | ||
.reply(201, updateResponse) | ||
|
@@ -71,7 +71,8 @@ test('events', function (t) { | |
t.deepEqual(signInHandler.lastCall.arg, { | ||
id: 'abc4567', | ||
username: '[email protected]', | ||
session: { id: 'sessionid123' } | ||
session: { id: 'sessionid123' }, | ||
profile: { favoriteClothing: 'Hoodie', fullName: 'Docs Chicken' } | ||
}, '"signin" event emitted with account object') | ||
|
||
return account.update({username: updateResponse.data.attributes.username}) | ||
|
@@ -86,7 +87,8 @@ test('events', function (t) { | |
t.deepEqual(updateHandler.lastCall.arg, { | ||
id: 'abc4567', | ||
username: '[email protected]', | ||
session: { id: 'sessionid123' } | ||
session: { id: 'sessionid123' }, | ||
profile: { favoriteClothing: 'Hoodie', fullName: 'Docs Chicken' } | ||
}, '"update" event emitted with account object') | ||
|
||
return account.signOut() | ||
|
@@ -96,7 +98,8 @@ test('events', function (t) { | |
t.deepEqual(signOutHandler.lastCall.arg, { | ||
id: 'abc4567', | ||
username: '[email protected]', | ||
session: { id: 'sessionid123' } | ||
session: { id: 'sessionid123' }, | ||
profile: { favoriteClothing: 'Hoodie', fullName: 'Docs Chicken' } | ||
}, '"signout" event emitted with account object') | ||
|
||
t.is(signUpHandler.callCount, 1, '"signup" event emitted once') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,15 @@ var options = { | |
|
||
test('sign in', function (t) { | ||
store.clear() | ||
t.plan(11) | ||
t.plan(12) | ||
|
||
var account = new Account({ | ||
url: baseURL, | ||
id: 'abc4567' | ||
}) | ||
|
||
nock(baseURL) | ||
.put('/session') | ||
.put('/session?include=account.profile') | ||
.reply(201, signInResponse) | ||
|
||
.delete('/session') | ||
|
@@ -43,13 +43,21 @@ test('sign in', function (t) { | |
username: '[email protected]', | ||
session: { | ||
id: 'sessionid123' | ||
}, | ||
profile: { | ||
fullName: 'Docs Chicken', | ||
favoriteClothing: 'Hoodie' | ||
} | ||
}, 'stores account with id with session') | ||
t.deepEqual(account.get(), { | ||
id: 'abc4567', | ||
username: '[email protected]', | ||
session: { | ||
id: 'sessionid123' | ||
}, | ||
profile: { | ||
fullName: 'Docs Chicken', | ||
favoriteClothing: 'Hoodie' | ||
} | ||
}, '.get() returns account with session') | ||
|
||
|
@@ -60,6 +68,7 @@ test('sign in', function (t) { | |
t.pass('signes out') | ||
|
||
t.is(signOutResult.username, '[email protected]') | ||
t.is(signOutResult.profile.fullName, 'Docs Chicken') | ||
|
||
var storeAccount = store.getObject('account') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters