Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: add support to ipns resolve /ipns/<fqdn>
Browse files Browse the repository at this point in the history
fixes: #1918
  • Loading branch information
hugomrdias committed Jun 27, 2019
1 parent 5044a30 commit 03dcab9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"ipns": "~0.5.2",
"is-domain-name": "^1.0.1",
"is-ipfs": "~0.6.1",
"is-domain-name": "^1.0.1",
"is-pull-stream": "~0.0.0",
"is-stream": "^2.0.0",
"iso-url": "~0.4.6",
Expand Down
39 changes: 39 additions & 0 deletions test/core/name.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,43 @@ describe('name', function () {
done()
})
})

describe('working with dns', function () {
let node
let ipfsd

before(function (done) {
df.spawn({
exec: IPFS,
args: [`--pass ${hat()}`, '--offline'],
config: { Bootstrap: [] }
}, (err, _ipfsd) => {
expect(err).to.not.exist()
ipfsd = _ipfsd
node = _ipfsd.api
done()
})
})

after((done) => ipfsd.stop(done))

it('should resolve ipfs.io', async () => {
const r = await node.name.resolve('ipfs.io', { recursive: false })
return expect(r).to.eq('/ipns/website.ipfs.io')
})

it('should resolve /ipns/ipfs.io recursive', async () => {
const r = await node.name.resolve('ipfs.io', { recursive: true })

return expect(r.substr(0, 6)).to.eql('/ipfs/')
})

it('should fail to resolve /ipns/ipfs.a', async () => {
try {
await node.name.resolve('ipfs.a')
} catch (err) {
expect(err).to.exist()
}
})
})
})

0 comments on commit 03dcab9

Please sign in to comment.