0
Fork 0
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:
Gao Sun 2022-11-09 16:45:25 +08:00
parent 4b6d3c584a
commit fd0b1d0717
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
3 changed files with 16 additions and 34 deletions

View file

@ -141,7 +141,7 @@ export default function adminUserRoutes<T extends AuthedRouter>(router: T) {
assertThat(
!primaryEmail || !(await hasUserWithEmail(primaryEmail)),
new RequestError({
code: 'user.username_exists_register',
code: 'user.email_exists_register',
status: 422,
})
);

View file

@ -52,24 +52,6 @@ export const signInWithPassword = async ({
})
.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) =>
api
.post('session/consent', {

View file

@ -1,6 +1,6 @@
import assert from 'assert';
import { SignInIdentifier, SignUpIdentifier } from '@logto/schemas';
import { adminConsoleApplicationId } from '@logto/schemas/lib/seeds';
import { assert } from '@silverhand/essentials';
import {
mockEmailConnectorId,
@ -9,27 +9,27 @@ import {
mockSmsConnectorConfig,
} from '@/__mocks__/connectors-mock';
import {
createUser,
disableConnector,
sendRegisterUserWithEmailPasscode,
sendRegisterUserWithSmsPasscode,
sendSignInUserWithEmailPasscode,
sendSignInUserWithSmsPasscode,
signInWithPassword,
verifyRegisterUserWithEmailPasscode,
verifyRegisterUserWithSmsPasscode,
sendSignInUserWithEmailPasscode,
verifySignInUserWithEmailPasscode,
sendRegisterUserWithSmsPasscode,
verifyRegisterUserWithSmsPasscode,
sendSignInUserWithSmsPasscode,
verifySignInUserWithSmsPasscode,
disableConnector,
signInWithPassword,
createUser,
} from '@/api';
import MockClient from '@/client';
import {
createUserByAdmin,
readPasscode,
registerNewUser,
setSignInMethod,
setSignUpIdentifier,
setUpConnector,
signIn,
setUpConnector,
readPasscode,
createUserByAdmin,
setSignUpIdentifier,
setSignInMethod,
} from '@/helpers';
import { generateUsername, generatePassword, generateEmail, generatePhone } from '@/utils';
@ -48,7 +48,7 @@ describe('email and password flow', () => {
const [localPart, domain] = email.split('@');
const password = generatePassword();
assert(localPart && domain);
assert(localPart && domain, new Error('Email address local part or domain is empty'));
beforeAll(async () => {
await setSignInMethod([