ci: Fix flaky sendVerificationEmail tests (#9692)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
|||||||
const emailAdapter = require('./support/MockEmailAdapter');
|
const emailAdapter = require('./support/MockEmailAdapter');
|
||||||
const Config = require('../lib/Config');
|
const Config = require('../lib/Config');
|
||||||
const Auth = require('../lib/Auth');
|
const Auth = require('../lib/Auth');
|
||||||
|
const { resolvingPromise } = require('../lib/TestUtils');
|
||||||
|
|
||||||
describe('UserController', () => {
|
describe('UserController', () => {
|
||||||
describe('sendVerificationEmail', () => {
|
describe('sendVerificationEmail', () => {
|
||||||
@@ -17,8 +18,10 @@ describe('UserController', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let emailOptions;
|
let emailOptions;
|
||||||
|
const sendPromise = resolvingPromise();
|
||||||
emailAdapter.sendVerificationEmail = options => {
|
emailAdapter.sendVerificationEmail = options => {
|
||||||
emailOptions = options;
|
emailOptions = options;
|
||||||
|
sendPromise.resolve();
|
||||||
};
|
};
|
||||||
|
|
||||||
const username = 'verificationUser';
|
const username = 'verificationUser';
|
||||||
@@ -27,6 +30,7 @@ describe('UserController', () => {
|
|||||||
user.setPassword('pass');
|
user.setPassword('pass');
|
||||||
user.setEmail('verification@example.com');
|
user.setEmail('verification@example.com');
|
||||||
await user.signUp();
|
await user.signUp();
|
||||||
|
await sendPromise;
|
||||||
|
|
||||||
const config = Config.get('test');
|
const config = Config.get('test');
|
||||||
const rawUser = await config.database.find('_User', { username }, {}, Auth.maintenance(config));
|
const rawUser = await config.database.find('_User', { username }, {}, Auth.maintenance(config));
|
||||||
@@ -52,8 +56,10 @@ describe('UserController', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let emailOptions;
|
let emailOptions;
|
||||||
|
const sendPromise = resolvingPromise();
|
||||||
emailAdapter.sendVerificationEmail = options => {
|
emailAdapter.sendVerificationEmail = options => {
|
||||||
emailOptions = options;
|
emailOptions = options;
|
||||||
|
sendPromise.resolve();
|
||||||
};
|
};
|
||||||
|
|
||||||
const username = 'verificationUser';
|
const username = 'verificationUser';
|
||||||
@@ -62,6 +68,7 @@ describe('UserController', () => {
|
|||||||
user.setPassword('pass');
|
user.setPassword('pass');
|
||||||
user.setEmail('verification@example.com');
|
user.setEmail('verification@example.com');
|
||||||
await user.signUp();
|
await user.signUp();
|
||||||
|
await sendPromise;
|
||||||
|
|
||||||
const config = Config.get('test');
|
const config = Config.get('test');
|
||||||
const rawUser = await config.database.find('_User', { username }, {}, Auth.maintenance(config));
|
const rawUser = await config.database.find('_User', { username }, {}, Auth.maintenance(config));
|
||||||
|
|||||||
@@ -14,16 +14,6 @@ const flakyTests = [
|
|||||||
"ParseLiveQuery handle invalid websocket payload length",
|
"ParseLiveQuery handle invalid websocket payload length",
|
||||||
// Unhandled promise rejection: TypeError: message.split is not a function
|
// Unhandled promise rejection: TypeError: message.split is not a function
|
||||||
"rest query query internal field",
|
"rest query query internal field",
|
||||||
// TypeError: Cannot read properties of undefined (reading 'link')
|
|
||||||
"UserController sendVerificationEmail parseFrameURL not provided uses publicServerURL",
|
|
||||||
// TypeError: Cannot read properties of undefined (reading 'link')
|
|
||||||
"UserController sendVerificationEmail parseFrameURL provided uses parseFrameURL and includes the destination in the link parameter",
|
|
||||||
// Expected undefined to be defined
|
|
||||||
"Email Verification Token Expiration: sets the _email_verify_token_expires_at and _email_verify_token fields after user SignUp",
|
|
||||||
// Expected 0 to be 1.
|
|
||||||
"Email Verification Token Expiration: should send a new verification email when a resend is requested and the user is UNVERIFIED",
|
|
||||||
// Expected 0 to be 1.
|
|
||||||
"Email Verification Token Expiration: should match codes with emailVerifyTokenReuseIfValid",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/** The minimum execution time in seconds for a test to be considered slow. */
|
/** The minimum execution time in seconds for a test to be considered slow. */
|
||||||
|
|||||||
Reference in New Issue
Block a user