diff options
author | Chocobozzz <me@florianbigard.com> | 2022-02-07 11:21:25 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-02-07 11:21:25 +0100 |
commit | f33e515991a32885622b217bf2ed1d1b0d9d6832 (patch) | |
tree | 43bf9e63c821f2b363ee60e8b1de07ab7c883580 /server/tests/helpers/dns.ts | |
parent | 4afec7357129590b0e0f3558ecb9ac20e0903600 (diff) | |
download | PeerTube-f33e515991a32885622b217bf2ed1d1b0d9d6832.tar.gz PeerTube-f33e515991a32885622b217bf2ed1d1b0d9d6832.tar.zst PeerTube-f33e515991a32885622b217bf2ed1d1b0d9d6832.zip |
Correctly check import target URL IP
Diffstat (limited to 'server/tests/helpers/dns.ts')
-rw-r--r-- | server/tests/helpers/dns.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/server/tests/helpers/dns.ts b/server/tests/helpers/dns.ts new file mode 100644 index 000000000..309de5426 --- /dev/null +++ b/server/tests/helpers/dns.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import 'mocha' | ||
4 | import { expect } from 'chai' | ||
5 | import { isResolvingToUnicastOnly } from '@server/helpers/dns' | ||
6 | |||
7 | describe('DNS helpers', function () { | ||
8 | |||
9 | it('Should correctly check unicast IPs', async function () { | ||
10 | expect(await isResolvingToUnicastOnly('cpy.re')).to.be.true | ||
11 | expect(await isResolvingToUnicastOnly('framasoft.org')).to.be.true | ||
12 | expect(await isResolvingToUnicastOnly('8.8.8.8')).to.be.true | ||
13 | |||
14 | expect(await isResolvingToUnicastOnly('127.0.0.1')).to.be.false | ||
15 | expect(await isResolvingToUnicastOnly('127.0.0.1.cpy.re')).to.be.false | ||
16 | }) | ||
17 | }) | ||