Skip to content

Commit

Permalink
fix: auth package tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yknl committed Oct 9, 2020
1 parent da29e8e commit 59f17de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 3 additions & 3 deletions packages/auth/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export async function makeAuthResponse(
privateKey: string,
profile: {} = {},
username: string | null = null,
metadata: AuthMetadata,
metadata: AuthMetadata | null,
coreToken: string | null = null,
appPrivateKey: string | null = null,
expiresAt: number = nextMonth().getTime(),
Expand All @@ -207,8 +207,8 @@ export async function makeAuthResponse(
}
}
additionalProperties = {
email: metadata.email ? metadata.email : null,
profile_url: metadata.profileUrl ? metadata.profileUrl : null,
email: metadata?.email ? metadata.email : null,
profile_url: metadata?.profileUrl ? metadata.profileUrl : null,
hubUrl,
blockstackAPIUrl,
associationToken,
Expand Down
9 changes: 0 additions & 9 deletions packages/auth/tests/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ test('makeAuthResponse && verifyAuthResponse', async () => {
})

test('auth response with username', async () => {

const url = `${nameLookupURL}ryan.id`

fetchMock.mockResponse(JSON.stringify(sampleNameRecords.ryan))

const authResponse = await makeAuthResponse(privateKey, sampleProfiles.ryan, 'ryan.id', null)
Expand All @@ -229,8 +226,6 @@ test('auth response with invalid private key', async () => {
const appConfig = new AppConfig(['store_write'], 'http://localhost:3000')
const blockstack = new UserSession({ appConfig })

const url = `${nameLookupURL}ryan.id`

fetchMock.mockResponse(JSON.stringify(sampleNameRecords.ryan))

const appPrivateKey = makeECPrivateKey()
Expand Down Expand Up @@ -322,8 +317,6 @@ test('handlePendingSignIn 2', async () => {
})

test('handlePendingSignIn with existing user session', async () => {
const url = `${nameLookupURL}ryan.id`

fetchMock.once(JSON.stringify(sampleNameRecords.ryan))

const appPrivateKey = makeECPrivateKey()
Expand Down Expand Up @@ -396,7 +389,6 @@ test('app config works with custom app domain to origin', () => {

test('handlePendingSignIn with authResponseToken, transit key and custom Blockstack API URL', async () => {
const customBlockstackAPIUrl = 'https://test.name.lookups'
const url = `${customBlockstackAPIUrl}/v1/names/ryan.id`

fetchMock.once(JSON.stringify(sampleNameRecords.ryan))

Expand Down Expand Up @@ -426,7 +418,6 @@ test('handlePendingSignIn with authResponseToken, transit key, '
+ 'Blockstack API URL, and Gaia association token', async () => {

const customBlockstackAPIUrl = 'https://test.name.lookups'
const url = `${customBlockstackAPIUrl}/v1/names/ryan.id`
fetchMock.mockResponse(JSON.stringify(sampleNameRecords.ryan))

const appPrivateKey = makeECPrivateKey()
Expand Down

0 comments on commit 59f17de

Please sign in to comment.