-
-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): rebase the core interaction apis change
rebase the core interaction apis change
- Loading branch information
Showing
4 changed files
with
71 additions
and
2 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
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
...egration-tests/src/tests/api/experience-api/sign-in-interaction/verification-code.test.ts
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,35 @@ | ||
import { deleteUser } from '#src/api/admin-user.js'; | ||
import { signInWithVerificationCode } from '#src/helpers/experience/index.js'; | ||
import { enableAllVerificationCodeSignInMethods } from '#src/helpers/sign-in-experience.js'; | ||
import { generateNewUser } from '#src/helpers/user.js'; | ||
import { devFeatureTest } from '#src/utils.js'; | ||
|
||
const verificationIdentifierType: readonly ['email', 'phone'] = Object.freeze(['email', 'phone']); | ||
|
||
const identifiersTypeToUserProfile = Object.freeze({ | ||
email: 'primaryEmail', | ||
phone: 'primaryPhone', | ||
}); | ||
|
||
devFeatureTest.describe('Sign-in with verification code happy path', () => { | ||
beforeAll(async () => { | ||
await enableAllVerificationCodeSignInMethods(); | ||
}); | ||
|
||
it.each(verificationIdentifierType)( | ||
'Should sign-in with verification code using %p', | ||
async (identifier) => { | ||
const { userProfile, user } = await generateNewUser({ | ||
[identifiersTypeToUserProfile[identifier]]: true, | ||
password: true, | ||
}); | ||
|
||
await signInWithVerificationCode({ | ||
type: identifier, | ||
value: userProfile[identifiersTypeToUserProfile[identifier]]!, | ||
}); | ||
|
||
await deleteUser(user.id); | ||
} | ||
); | ||
}); |