forked from ipfs-shipyard/ipfs-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dnsimple.spec.js
42 lines (35 loc) · 1 KB
/
dnsimple.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* eslint max-nested-callbacks: ["error", 8] */
/* eslint-env mocha */
'use strict'
const { expect } = require('aegir/utils/chai')
const proxyquire = require('proxyquire').noCallThru()
const DNSimple = proxyquire('../../src/dnslinkers/dnsimple', {
// @ts-ignore
'dnslink-dnsimple': (_token, { link }) => {
return { record: { content: `dnslink=${link}` } }
}
})
it('dnsimple throws with wrong options', () => {
expect(() => {
return new DNSimple({})
}).to.throw()
})
it('dnsimple succeeds on correct options', () => {
expect(() => {
return new DNSimple({
token: 'XXXXXXXXXXXXXXX',
zone: 'example.com',
record: '_dnslink'
})
}).to.not.throw()
})
it('dnsimple link returns correct output', async () => {
const dnsimple = new DNSimple({
token: 'XXXXXXXXXXXXXXX',
zone: 'example.com',
record: '_dnslink'
})
const res = await dnsimple.link('QmHash')
expect(res.record).to.equal('_dnslink.example.com')
expect(res.value).to.equal('dnslink=/ipfs/QmHash')
})