mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
test(core): Skip SMTP tests if service unavailable (#3293)
This commit is contained in:
@@ -26,6 +26,7 @@ import { credentialsController } from '../../../src/api/credentials.api';
|
||||
import type { User } from '../../../src/databases/entities/User';
|
||||
import type { EndpointGroup, SmtpTestAccount } from './types';
|
||||
import type { N8nApp } from '../../../src/UserManagement/Interfaces';
|
||||
import * as UserManagementMailer from '../../../src/UserManagement/email/UserManagementMailer';
|
||||
|
||||
/**
|
||||
* Initialize a test server.
|
||||
@@ -229,6 +230,21 @@ export async function configureSmtp() {
|
||||
config.set('userManagement.emails.smtp.auth.pass', pass);
|
||||
}
|
||||
|
||||
export async function isTestSmtpServiceAvailable() {
|
||||
try {
|
||||
await configureSmtp();
|
||||
await UserManagementMailer.getInstance();
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function skipSmtpTest(expect: jest.Expect) {
|
||||
console.warn(`SMTP service unavailable - Skipping test ${expect.getState().currentTestName}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
// misc
|
||||
// ----------------------------------
|
||||
|
||||
Reference in New Issue
Block a user