-
Notifications
You must be signed in to change notification settings - Fork 392
user record changes for getAccountInfo() #2341
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c5045b5
user record changes for getAccountInfo()
pragatimodi da7aa6e
lint and api-extractor fixes
pragatimodi ffb982e
Apply suggestions from code review
pragatimodi a269d5a
remove `[key: string]: unknown;` field from `PasskeyInfoResponse`
pragatimodi ccc2ecb
Merge branch 'user-record' of https://github.com/firebase/firebase-ad…
pragatimodi 100af72
add undefined displayName case
pragatimodi a6de4bb
name and credentialId are not optional
pragatimodi d3d1751
add `rpId` to update
pragatimodi 9d41e9f
Merge branch 'passkeys' into user-record
pragatimodi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -172,4 +172,5 @@ export { | |
UserInfo, | ||
UserMetadata, | ||
UserRecord, | ||
PasskeyInfo, | ||
} from './user-record'; |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -21,7 +21,7 @@ import * as chaiAsPromised from 'chai-as-promised'; | |
|
||
import { deepCopy } from '../../../src/utils/deep-copy'; | ||
import { | ||
GetAccountInfoUserResponse, ProviderUserInfoResponse, MultiFactorInfoResponse, TotpMultiFactorInfo, | ||
GetAccountInfoUserResponse, ProviderUserInfoResponse, MultiFactorInfoResponse, TotpMultiFactorInfo, PasskeyInfo, | ||
} from '../../../src/auth/user-record'; | ||
import { | ||
UserInfo, UserMetadata, UserRecord, MultiFactorSettings, MultiFactorInfo, PhoneMultiFactorInfo, | ||
|
@@ -100,6 +100,18 @@ function getValidUserResponse(tenantId?: string): GetAccountInfoUserResponse { | |
phoneInfo: '+16505556789', | ||
}, | ||
], | ||
passkeyInfo: [ | ||
{ | ||
name: '[email protected]', | ||
credentialId: 'credentialId1', | ||
displayName: 'passkey1', | ||
}, | ||
{ | ||
name: '[email protected]', | ||
credentialId: 'credentialId2', | ||
displayName: 'passkey2', | ||
} | ||
] | ||
}; | ||
if (typeof tenantId !== 'undefined') { | ||
response.tenantId = tenantId; | ||
|
@@ -185,6 +197,18 @@ function getUserJSON(tenantId?: string): object { | |
}, | ||
], | ||
}, | ||
passkeyInfo: [ | ||
pragatimodi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
name: '[email protected]', | ||
credentialId: 'credentialId1', | ||
displayName: 'passkey1', | ||
}, | ||
{ | ||
name: '[email protected]', | ||
credentialId: 'credentialId2', | ||
displayName: 'passkey2', | ||
} | ||
] | ||
}; | ||
} | ||
|
||
|
@@ -663,6 +687,66 @@ describe('MultiFactorSettings', () => { | |
}); | ||
}); | ||
|
||
describe('PasskeyInfo', () => { | ||
const passkeyInfoData = { | ||
name: 'John Doe', | ||
credentialId: 'credential123', | ||
displayName: '[email protected]', | ||
}; | ||
const passkeyInfo = new PasskeyInfo(passkeyInfoData); | ||
|
||
describe('constructor', () => { | ||
it('should create a PasskeyInfo object with valid data', () => { | ||
expect(passkeyInfo).to.be.an.instanceOf(PasskeyInfo); | ||
}); | ||
|
||
it('should throw when missing required fields', () => { | ||
expect(() => { | ||
return new PasskeyInfo(null as any); | ||
}).to.throw('INTERNAL ASSERT FAILED: Invalid passkey info response'); | ||
}); | ||
}); | ||
|
||
describe('getters', () => { | ||
it('should return the expected name', () => { | ||
expect(passkeyInfo.name).to.equal(passkeyInfoData.name); | ||
}); | ||
|
||
it('should throw when modifying readonly name property', () => { | ||
expect(() => { | ||
(passkeyInfo as any).name = 'Modified Name'; | ||
}).to.throw(Error); | ||
}); | ||
|
||
it('should return the expected credentialId', () => { | ||
expect(passkeyInfo.credentialId).to.equal(passkeyInfoData.credentialId); | ||
}); | ||
|
||
it('should throw when modifying readonly credentialId property', () => { | ||
expect(() => { | ||
(passkeyInfo as any).credentialId = 'modifiedCredential'; | ||
}).to.throw(Error); | ||
}); | ||
|
||
it('should return the expected displayName', () => { | ||
expect(passkeyInfo.displayName).to.equal(passkeyInfoData.displayName); | ||
}); | ||
|
||
it('should throw when modifying readonly displayName property', () => { | ||
expect(() => { | ||
(passkeyInfo as any).displayName = 'modifiedDisplayName'; | ||
}).to.throw(Error); | ||
}); | ||
}); | ||
|
||
describe('toJSON', () => { | ||
it('should return the expected JSON object', () => { | ||
expect(passkeyInfo.toJSON()).to.deep.equal(passkeyInfoData); | ||
}); | ||
}); | ||
}); | ||
|
||
|
||
describe('UserInfo', () => { | ||
describe('constructor', () => { | ||
it('should throw when an empty object is provided', () => { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.