Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
✅ Add tests for DNS service
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 8, 2020
1 parent 4a5445f commit d9ad820
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/modules/dns/dns.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { MxRecord } from 'dns';
import { DnsService } from './dns.service';

const dnsService = new DnsService();

describe('DnsService', () => {
describe('lookup', () => {
it('gets MX records', async () => {
const result = await dnsService.lookup('google.com', 'MX');
expect(result).toBeDefined();
});
it('gets correct MX record', async () => {
const result = (await dnsService.lookup(
'google.com',
'MX',
)) as MxRecord[];
expect(
result.find((i) => i.exchange === 'aspmx.l.google.com'),
).toBeTruthy();
});
});
});

0 comments on commit d9ad820

Please sign in to comment.