diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/check-params/video-imports.ts | 3 | ||||
-rw-r--r-- | server/tests/helpers/dns.ts | 17 | ||||
-rw-r--r-- | server/tests/helpers/index.ts | 1 |
3 files changed, 20 insertions, 1 deletions
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 156a612ee..7893f5cc5 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts | |||
@@ -120,7 +120,8 @@ describe('Test video imports API validator', function () { | |||
120 | 'http://127.0.0.1', | 120 | 'http://127.0.0.1', |
121 | 'http://127.0.0.1/hello', | 121 | 'http://127.0.0.1/hello', |
122 | 'https://192.168.1.42', | 122 | 'https://192.168.1.42', |
123 | 'http://192.168.1.42' | 123 | 'http://192.168.1.42', |
124 | 'http://127.0.0.1.cpy.re' | ||
124 | ] | 125 | ] |
125 | 126 | ||
126 | for (const targetUrl of targetUrls) { | 127 | for (const targetUrl of targetUrls) { |
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 | }) | ||
diff --git a/server/tests/helpers/index.ts b/server/tests/helpers/index.ts index 91d11e25d..951208842 100644 --- a/server/tests/helpers/index.ts +++ b/server/tests/helpers/index.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import './image' | 1 | import './image' |
2 | import './core-utils' | 2 | import './core-utils' |
3 | import './dns' | ||
3 | import './comment-model' | 4 | import './comment-model' |
4 | import './markdown' | 5 | import './markdown' |
5 | import './request' | 6 | import './request' |