forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include email on server.getSession (bluesky-social#756)
* include email on getSession * fix up tests & return email on createSession * fix more tests * cleanup
- Loading branch information
Showing
9 changed files
with
30 additions
and
7 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 |
---|---|---|
|
@@ -54,6 +54,7 @@ describe('agent', () => { | |
expect(sessionInfo).toEqual({ | ||
did: res.data.did, | ||
handle: res.data.handle, | ||
email: '[email protected]', | ||
}) | ||
|
||
expect(events.length).toEqual(1) | ||
|
@@ -72,9 +73,10 @@ describe('agent', () => { | |
|
||
const agent1 = new AtpAgent({ service: server.url, persistSession }) | ||
|
||
const email = '[email protected]' | ||
await agent1.createAccount({ | ||
handle: 'user2.test', | ||
email: '[email protected]', | ||
email, | ||
password: 'password', | ||
}) | ||
|
||
|
@@ -95,6 +97,7 @@ describe('agent', () => { | |
expect(sessionInfo).toEqual({ | ||
did: res1.data.did, | ||
handle: res1.data.handle, | ||
email, | ||
}) | ||
|
||
expect(events.length).toEqual(2) | ||
|
@@ -136,6 +139,7 @@ describe('agent', () => { | |
expect(sessionInfo).toEqual({ | ||
did: res1.data.did, | ||
handle: res1.data.handle, | ||
email: res1.data.email, | ||
}) | ||
|
||
expect(events.length).toEqual(2) | ||
|
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
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 |
---|---|---|
|
@@ -56,14 +56,19 @@ describe('auth', () => { | |
} | ||
|
||
it('provides valid access and refresh token on account creation.', async () => { | ||
const email = '[email protected]' | ||
const account = await createAccount({ | ||
handle: 'alice.test', | ||
email: '[email protected]', | ||
email, | ||
password: 'password', | ||
}) | ||
// Valid access token | ||
const sessionInfo = await getSession(account.accessJwt) | ||
expect(sessionInfo).toEqual({ did: account.did, handle: account.handle }) | ||
expect(sessionInfo).toEqual({ | ||
did: account.did, | ||
handle: account.handle, | ||
email, | ||
}) | ||
// Valid refresh token | ||
const nextSession = await refreshSession(account.refreshJwt) | ||
expect(nextSession).toEqual( | ||
|
@@ -75,9 +80,10 @@ describe('auth', () => { | |
}) | ||
|
||
it('provides valid access and refresh token on session creation.', async () => { | ||
const email = '[email protected]' | ||
await createAccount({ | ||
handle: 'bob.test', | ||
email: '[email protected]', | ||
email, | ||
password: 'password', | ||
}) | ||
const session = await createSession({ | ||
|
@@ -89,6 +95,7 @@ describe('auth', () => { | |
expect(sessionInfo).toEqual({ | ||
did: session.did, | ||
handle: session.handle, | ||
email, | ||
}) | ||
// Valid refresh token | ||
const nextSession = await refreshSession(session.refreshJwt) | ||
|
@@ -127,17 +134,19 @@ describe('auth', () => { | |
}) | ||
|
||
it('provides valid access and refresh token on session refresh.', async () => { | ||
const email = '[email protected]' | ||
const account = await createAccount({ | ||
handle: 'carol.test', | ||
email: '[email protected]', | ||
password: 'password', | ||
email, | ||
}) | ||
const session = await refreshSession(account.refreshJwt) | ||
// Valid access token | ||
const sessionInfo = await getSession(session.accessJwt) | ||
expect(sessionInfo).toEqual({ | ||
did: session.did, | ||
handle: session.handle, | ||
email, | ||
}) | ||
// Valid refresh token | ||
const nextSession = await refreshSession(session.refreshJwt) | ||
|