Skip to content

Commit

Permalink
test: ensure mx lookup timeout triggers correctly during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jesselpalmer authored Aug 20, 2024
2 parents 69ad463 + aba6c20 commit 3324144
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ const checkMxRecords = async (email) => {
const domain = email.split('@')[1];

try {
// Introduce a delay for testing purposes
if (process.env.NODE_ENV === 'test') {
await setTimeout(10); // Simulate a delay in DNS lookup
}

const records = await resolveMx(domain);
return records && records.length > 0;
} catch (error) {
Expand Down

0 comments on commit 3324144

Please sign in to comment.