mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
refactor(test): revert unexpected changes
This commit is contained in:
parent
4b6d3c584a
commit
fd0b1d0717
3 changed files with 16 additions and 34 deletions
|
@ -141,7 +141,7 @@ export default function adminUserRoutes<T extends AuthedRouter>(router: T) {
|
||||||
assertThat(
|
assertThat(
|
||||||
!primaryEmail || !(await hasUserWithEmail(primaryEmail)),
|
!primaryEmail || !(await hasUserWithEmail(primaryEmail)),
|
||||||
new RequestError({
|
new RequestError({
|
||||||
code: 'user.username_exists_register',
|
code: 'user.email_exists_register',
|
||||||
status: 422,
|
status: 422,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -52,24 +52,6 @@ export const signInWithPassword = async ({
|
||||||
})
|
})
|
||||||
.json<RedirectResponse>();
|
.json<RedirectResponse>();
|
||||||
|
|
||||||
export const signInWithEmailAndPassword = async (
|
|
||||||
email: string,
|
|
||||||
password: string,
|
|
||||||
interactionCookie: string
|
|
||||||
) =>
|
|
||||||
api
|
|
||||||
.post('session/sign-in/email/username', {
|
|
||||||
headers: {
|
|
||||||
cookie: interactionCookie,
|
|
||||||
},
|
|
||||||
json: {
|
|
||||||
email,
|
|
||||||
password,
|
|
||||||
},
|
|
||||||
followRedirect: false,
|
|
||||||
})
|
|
||||||
.json<RedirectResponse>();
|
|
||||||
|
|
||||||
export const consent = async (interactionCookie: string) =>
|
export const consent = async (interactionCookie: string) =>
|
||||||
api
|
api
|
||||||
.post('session/consent', {
|
.post('session/consent', {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import assert from 'assert';
|
import { SignInIdentifier, SignUpIdentifier } from '@logto/schemas';
|
||||||
|
|
||||||
import { adminConsoleApplicationId } from '@logto/schemas/lib/seeds';
|
import { adminConsoleApplicationId } from '@logto/schemas/lib/seeds';
|
||||||
|
import { assert } from '@silverhand/essentials';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
mockEmailConnectorId,
|
mockEmailConnectorId,
|
||||||
|
@ -9,27 +9,27 @@ import {
|
||||||
mockSmsConnectorConfig,
|
mockSmsConnectorConfig,
|
||||||
} from '@/__mocks__/connectors-mock';
|
} from '@/__mocks__/connectors-mock';
|
||||||
import {
|
import {
|
||||||
createUser,
|
|
||||||
disableConnector,
|
|
||||||
sendRegisterUserWithEmailPasscode,
|
sendRegisterUserWithEmailPasscode,
|
||||||
sendRegisterUserWithSmsPasscode,
|
|
||||||
sendSignInUserWithEmailPasscode,
|
|
||||||
sendSignInUserWithSmsPasscode,
|
|
||||||
signInWithPassword,
|
|
||||||
verifyRegisterUserWithEmailPasscode,
|
verifyRegisterUserWithEmailPasscode,
|
||||||
verifyRegisterUserWithSmsPasscode,
|
sendSignInUserWithEmailPasscode,
|
||||||
verifySignInUserWithEmailPasscode,
|
verifySignInUserWithEmailPasscode,
|
||||||
|
sendRegisterUserWithSmsPasscode,
|
||||||
|
verifyRegisterUserWithSmsPasscode,
|
||||||
|
sendSignInUserWithSmsPasscode,
|
||||||
verifySignInUserWithSmsPasscode,
|
verifySignInUserWithSmsPasscode,
|
||||||
|
disableConnector,
|
||||||
|
signInWithPassword,
|
||||||
|
createUser,
|
||||||
} from '@/api';
|
} from '@/api';
|
||||||
import MockClient from '@/client';
|
import MockClient from '@/client';
|
||||||
import {
|
import {
|
||||||
createUserByAdmin,
|
|
||||||
readPasscode,
|
|
||||||
registerNewUser,
|
registerNewUser,
|
||||||
setSignInMethod,
|
|
||||||
setSignUpIdentifier,
|
|
||||||
setUpConnector,
|
|
||||||
signIn,
|
signIn,
|
||||||
|
setUpConnector,
|
||||||
|
readPasscode,
|
||||||
|
createUserByAdmin,
|
||||||
|
setSignUpIdentifier,
|
||||||
|
setSignInMethod,
|
||||||
} from '@/helpers';
|
} from '@/helpers';
|
||||||
import { generateUsername, generatePassword, generateEmail, generatePhone } from '@/utils';
|
import { generateUsername, generatePassword, generateEmail, generatePhone } from '@/utils';
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ describe('email and password flow', () => {
|
||||||
const [localPart, domain] = email.split('@');
|
const [localPart, domain] = email.split('@');
|
||||||
const password = generatePassword();
|
const password = generatePassword();
|
||||||
|
|
||||||
assert(localPart && domain);
|
assert(localPart && domain, new Error('Email address local part or domain is empty'));
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await setSignInMethod([
|
await setSignInMethod([
|
||||||
|
|
Loading…
Add table
Reference in a new issue