aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/helpers')
-rw-r--r--server/tests/helpers/dns.ts17
-rw-r--r--server/tests/helpers/index.ts1
2 files changed, 18 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
3import 'mocha'
4import { expect } from 'chai'
5import { isResolvingToUnicastOnly } from '@server/helpers/dns'
6
7describe('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 @@
1import './image' 1import './image'
2import './core-utils' 2import './core-utils'
3import './dns'
3import './comment-model' 4import './comment-model'
4import './markdown' 5import './markdown'
5import './request' 6import './request'