mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-25 00:11:06 +00:00
6f02b17968
Also add integration tests for the resolver functionality to prevent regressions. Change-type: patch
25 lines
819 B
TypeScript
25 lines
819 B
TypeScript
import { expect } from 'chai';
|
|
import { promisify } from 'util';
|
|
|
|
import '~/src/mdns';
|
|
|
|
describe('MDNS', () => {
|
|
it('resolves global domain names', async () => {
|
|
const dns = require('dns'); // eslint-disable-line
|
|
const lookup = promisify(dns.lookup);
|
|
const res = await lookup('www.google.com', { all: true });
|
|
expect(res).to.not.be.null;
|
|
expect(res.length).to.be.greaterThan(0);
|
|
expect(Object.keys(res[0])).to.deep.equal(['address', 'family']);
|
|
});
|
|
|
|
it('resolves .local domain names', async () => {
|
|
const dns = require('dns'); // eslint-disable-line
|
|
const lookup = promisify(dns.lookup);
|
|
const res = await lookup('my-device.local', { all: true });
|
|
expect(res).to.not.be.null;
|
|
expect(res.length).to.be.greaterThan(0);
|
|
expect(Object.keys(res[0])).to.deep.equal(['address', 'family']);
|
|
});
|
|
});
|