Skip to content

Commit 3324144

Browse files
authored
test: ensure mx lookup timeout triggers correctly during tests
2 parents 69ad463 + aba6c20 commit 3324144

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ const checkMxRecords = async (email) => {
2828
const domain = email.split('@')[1];
2929

3030
try {
31+
// Introduce a delay for testing purposes
32+
if (process.env.NODE_ENV === 'test') {
33+
await setTimeout(10); // Simulate a delay in DNS lookup
34+
}
35+
3136
const records = await resolveMx(domain);
3237
return records && records.length > 0;
3338
} catch (error) {

0 commit comments

Comments
 (0)