Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve integration tests #5577

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/integration-tests/src/helpers/sign-in-experience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ export const enableAllPasswordSignInMethods = async (
mfa: { factors: [], policy: MfaPolicy.UserControlled },
});

export const resetPasswordPolicy = async () =>
updateSignInExperience({
passwordPolicy: {
length: { min: 8, max: 256 },
characterTypes: { min: 1 },
rejects: { pwned: true, repetitionAndSequence: true, userInfo: true },
},
});

export const enableAllVerificationCodeSignInMethods = async (
signUp: SignInExperience['signUp'] = defaultSignUpMethod
) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { readConnectorMessage, expectRejects } from '#src/helpers/index.js';
import {
enableAllVerificationCodeSignInMethods,
enableAllPasswordSignInMethods,
resetPasswordPolicy,
} from '#src/helpers/sign-in-experience.js';
import { generateNewUserProfile, generateNewUser } from '#src/helpers/user.js';

Expand All @@ -31,6 +32,8 @@ describe('register with username and password', () => {
password: true,
verify: false,
});
// Run it sequentially to avoid race condition
await resetPasswordPolicy();

const { username, password } = generateNewUserProfile({ username: true, password: true });
const client = await initClient();
Expand All @@ -56,7 +59,10 @@ describe('register with passwordless identifier', () => {
await clearConnectorsByTypes([ConnectorType.Email, ConnectorType.Sms]);
await setEmailConnector();
await setSmsConnector();
// Run it sequentially to avoid race condition
await resetPasswordPolicy();
});

afterAll(async () => {
await clearConnectorsByTypes([ConnectorType.Email, ConnectorType.Sms]);
});
Expand Down
Loading