mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
fix(test): update passwordless integration test
update passwordless integration test
This commit is contained in:
parent
e4914c9451
commit
187f7d38e4
2 changed files with 62 additions and 64 deletions
|
@ -68,16 +68,18 @@ export const verifyRegisterUserWithEmailPasscode = (
|
|||
code: string,
|
||||
interactionCookie: string
|
||||
) =>
|
||||
api.post('session/passwordless/email/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
code,
|
||||
flow: PasscodeType.Register,
|
||||
},
|
||||
});
|
||||
api
|
||||
.post('session/passwordless/email/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
code,
|
||||
flow: PasscodeType.Register,
|
||||
},
|
||||
})
|
||||
.json<RedirectResponse>();
|
||||
|
||||
export const checkVerificationSessionAndRegisterWithEmail = (interactionCookie: string) =>
|
||||
api
|
||||
|
@ -104,16 +106,18 @@ export const verifySignInUserWithEmailPasscode = (
|
|||
code: string,
|
||||
interactionCookie: string
|
||||
) =>
|
||||
api.post('session/passwordless/email/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
code,
|
||||
flow: PasscodeType.SignIn,
|
||||
},
|
||||
});
|
||||
api
|
||||
.post('session/passwordless/email/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
code,
|
||||
flow: PasscodeType.SignIn,
|
||||
},
|
||||
})
|
||||
.json<RedirectResponse>();
|
||||
|
||||
export const checkVerificationSessionAndSignInWithEmail = (interactionCookie: string) =>
|
||||
api
|
||||
|
@ -140,16 +144,18 @@ export const verifyRegisterUserWithSmsPasscode = (
|
|||
code: string,
|
||||
interactionCookie: string
|
||||
) =>
|
||||
api.post('session/passwordless/sms/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
code,
|
||||
flow: PasscodeType.Register,
|
||||
},
|
||||
});
|
||||
api
|
||||
.post('session/passwordless/sms/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
code,
|
||||
flow: PasscodeType.Register,
|
||||
},
|
||||
})
|
||||
.json<RedirectResponse>();
|
||||
|
||||
export const checkVerificationSessionAndRegisterWithSms = (interactionCookie: string) =>
|
||||
api
|
||||
|
@ -176,16 +182,18 @@ export const verifySignInUserWithSmsPasscode = (
|
|||
code: string,
|
||||
interactionCookie: string
|
||||
) =>
|
||||
api.post('session/passwordless/sms/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
code,
|
||||
flow: PasscodeType.SignIn,
|
||||
},
|
||||
});
|
||||
api
|
||||
.post('session/passwordless/sms/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
code,
|
||||
flow: PasscodeType.SignIn,
|
||||
},
|
||||
})
|
||||
.json<RedirectResponse>();
|
||||
|
||||
export const checkVerificationSessionAndSignInWithSms = (interactionCookie: string) =>
|
||||
api
|
||||
|
|
|
@ -10,16 +10,12 @@ import {
|
|||
import {
|
||||
sendRegisterUserWithEmailPasscode,
|
||||
verifyRegisterUserWithEmailPasscode,
|
||||
checkVerificationSessionAndRegisterWithEmail,
|
||||
sendSignInUserWithEmailPasscode,
|
||||
verifySignInUserWithEmailPasscode,
|
||||
checkVerificationSessionAndSignInWithEmail,
|
||||
sendRegisterUserWithSmsPasscode,
|
||||
verifyRegisterUserWithSmsPasscode,
|
||||
checkVerificationSessionAndRegisterWithSms,
|
||||
sendSignInUserWithSmsPasscode,
|
||||
verifySignInUserWithSmsPasscode,
|
||||
checkVerificationSessionAndSignInWithSms,
|
||||
disableConnector,
|
||||
signInWithUsernameAndPassword,
|
||||
} from '@/api';
|
||||
|
@ -73,11 +69,9 @@ describe('email passwordless flow', () => {
|
|||
|
||||
const { code } = passcodeRecord;
|
||||
|
||||
await expect(
|
||||
verifyRegisterUserWithEmailPasscode(email, code, client.interactionCookie)
|
||||
).resolves.not.toThrow();
|
||||
|
||||
const { redirectTo } = await checkVerificationSessionAndRegisterWithEmail(
|
||||
const { redirectTo } = await verifyRegisterUserWithEmailPasscode(
|
||||
email,
|
||||
code,
|
||||
client.interactionCookie
|
||||
);
|
||||
|
||||
|
@ -105,11 +99,9 @@ describe('email passwordless flow', () => {
|
|||
|
||||
const { code } = passcodeRecord;
|
||||
|
||||
await expect(
|
||||
verifySignInUserWithEmailPasscode(email, code, client.interactionCookie)
|
||||
).resolves.not.toThrow();
|
||||
|
||||
const { redirectTo } = await checkVerificationSessionAndSignInWithEmail(
|
||||
const { redirectTo } = await verifySignInUserWithEmailPasscode(
|
||||
email,
|
||||
code,
|
||||
client.interactionCookie
|
||||
);
|
||||
|
||||
|
@ -150,11 +142,9 @@ describe('sms passwordless flow', () => {
|
|||
|
||||
const { code } = passcodeRecord;
|
||||
|
||||
await expect(
|
||||
verifyRegisterUserWithSmsPasscode(phone, code, client.interactionCookie)
|
||||
).resolves.not.toThrow();
|
||||
|
||||
const { redirectTo } = await checkVerificationSessionAndRegisterWithSms(
|
||||
const { redirectTo } = await verifyRegisterUserWithSmsPasscode(
|
||||
phone,
|
||||
code,
|
||||
client.interactionCookie
|
||||
);
|
||||
|
||||
|
@ -182,11 +172,11 @@ describe('sms passwordless flow', () => {
|
|||
|
||||
const { code } = passcodeRecord;
|
||||
|
||||
await expect(
|
||||
verifySignInUserWithSmsPasscode(phone, code, client.interactionCookie)
|
||||
).resolves.not.toThrow();
|
||||
|
||||
const { redirectTo } = await checkVerificationSessionAndSignInWithSms(client.interactionCookie);
|
||||
const { redirectTo } = await verifySignInUserWithSmsPasscode(
|
||||
phone,
|
||||
code,
|
||||
client.interactionCookie
|
||||
);
|
||||
|
||||
await client.processSession(redirectTo);
|
||||
|
||||
|
|
Loading…
Reference in a new issue