aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/tests/src/server-helpers/dns.ts
blob: 64e3112a26a226bebecf3ba39181dd1eca135dc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */

import { expect } from 'chai'
import { isResolvingToUnicastOnly } from '@peertube/peertube-server/server/helpers/dns.js'

describe('DNS helpers', function () {

  it('Should correctly check unicast IPs', async function () {
    expect(await isResolvingToUnicastOnly('cpy.re')).to.be.true
    expect(await isResolvingToUnicastOnly('framasoft.org')).to.be.true
    expect(await isResolvingToUnicastOnly('8.8.8.8')).to.be.true

    expect(await isResolvingToUnicastOnly('127.0.0.1')).to.be.false
    expect(await isResolvingToUnicastOnly('127.0.0.1.cpy.re')).to.be.false
  })
})