diff options
Diffstat (limited to 'packages/tests/src/server-helpers/dns.ts')
-rw-r--r-- | packages/tests/src/server-helpers/dns.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/tests/src/server-helpers/dns.ts b/packages/tests/src/server-helpers/dns.ts new file mode 100644 index 000000000..64e3112a2 --- /dev/null +++ b/packages/tests/src/server-helpers/dns.ts | |||
@@ -0,0 +1,16 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import { expect } from 'chai' | ||
4 | import { isResolvingToUnicastOnly } from '@peertube/peertube-server/server/helpers/dns.js' | ||
5 | |||
6 | describe('DNS helpers', function () { | ||
7 | |||
8 | it('Should correctly check unicast IPs', async function () { | ||
9 | expect(await isResolvingToUnicastOnly('cpy.re')).to.be.true | ||
10 | expect(await isResolvingToUnicastOnly('framasoft.org')).to.be.true | ||
11 | expect(await isResolvingToUnicastOnly('8.8.8.8')).to.be.true | ||
12 | |||
13 | expect(await isResolvingToUnicastOnly('127.0.0.1')).to.be.false | ||
14 | expect(await isResolvingToUnicastOnly('127.0.0.1.cpy.re')).to.be.false | ||
15 | }) | ||
16 | }) | ||