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 committed Aug 20, 2024
1 parent 69ad463 commit aba6c20
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 aba6c20

Please sign in to comment.