-
-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core,schemas): implement the username password registration flow (…
…#6249) * feat(core,schemas): implement the username password registration flow implement the username password registration flow * chore(core): update some comments update some comments * fix(test): fix integration tests fix integration tests * fix(test): fix lint fix lint
- Loading branch information
Showing
18 changed files
with
589 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { type InteractionIdentifier, SignInIdentifier } from '@logto/schemas'; | ||
|
||
import { type InteractionProfile } from '../types.js'; | ||
|
||
import { interactionIdentifierToUserProfile, profileToUserInfo } from './utils.js'; | ||
|
||
const identifierToProfileTestCase = [ | ||
{ | ||
identifier: { | ||
type: SignInIdentifier.Username, | ||
value: 'username', | ||
}, | ||
expected: { username: 'username' }, | ||
}, | ||
{ | ||
identifier: { | ||
type: SignInIdentifier.Email, | ||
value: 'email', | ||
}, | ||
expected: { primaryEmail: 'email' }, | ||
}, | ||
{ | ||
identifier: { | ||
type: SignInIdentifier.Phone, | ||
value: 'phone', | ||
}, | ||
expected: { primaryPhone: 'phone' }, | ||
}, | ||
] satisfies Array<{ identifier: InteractionIdentifier; expected: InteractionProfile }>; | ||
|
||
describe('experience utils tests', () => { | ||
it.each(identifierToProfileTestCase)( | ||
`interactionIdentifierToUserProfile %p`, | ||
({ identifier, expected }) => { | ||
expect(interactionIdentifierToUserProfile(identifier)).toEqual(expected); | ||
} | ||
); | ||
it('profileToUserInfo', () => { | ||
expect( | ||
profileToUserInfo({ | ||
username: 'username', | ||
primaryEmail: 'email', | ||
primaryPhone: 'phone', | ||
}) | ||
).toEqual({ | ||
name: undefined, | ||
username: 'username', | ||
email: 'email', | ||
phoneNumber: 'phone', | ||
}); | ||
}); | ||
}); |
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
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
Oops, something went wrong.