This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable recursive lookups on ipfs.dns
- Loading branch information
Showing
5 changed files
with
128 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
|
||
const IPFSFactory = require('ipfsd-ctl') | ||
const IPFS = require('../../src/core') | ||
|
||
describe('.dns', () => { | ||
let ipfsd, ipfs | ||
|
||
before(function (done) { | ||
this.timeout(20 * 1000) | ||
|
||
const factory = IPFSFactory.create({ type: 'proc' }) | ||
|
||
factory.spawn({ | ||
exec: IPFS, | ||
initOptions: { bits: 512 }, | ||
config: { Bootstrap: [] } | ||
}, (err, _ipfsd) => { | ||
expect(err).to.not.exist() | ||
ipfsd = _ipfsd | ||
ipfs = _ipfsd.api | ||
done() | ||
}) | ||
}) | ||
|
||
after((done) => { | ||
if (ipfsd) { | ||
ipfsd.stop(done) | ||
} else { | ||
done() | ||
} | ||
}) | ||
|
||
// skipping because there is an error in https://ipfs.io/api/v0/dns?arg=ipfs.io | ||
// unskip once this is resolved: https://github.com/ipfs/go-ipfs/issues/6086 | ||
it.skip('should resolve ipfs.io', () => { | ||
return ipfs.dns('ipfs.io').then(res => { | ||
// matches pattern /ipns/<ipnsaddress> | ||
expect(res).to.match(/\/ipns\/.+$/) | ||
}) | ||
}) | ||
|
||
it('should recursively resolve ipfs.io', () => { | ||
return ipfs.dns('ipfs.io', { recursive: true }).then(res => { | ||
// matches pattern /ipfs/<hash> | ||
expect(res).to.match(/\/ipfs\/.+$/) | ||
}) | ||
}) | ||
|
||
it('should resolve subdomain docs.ipfs.io', () => { | ||
return ipfs.dns('docs.ipfs.io').then(res => { | ||
// matches pattern /ipfs/<hash> | ||
expect(res).to.match(/\/ipfs\/.+$/) | ||
}) | ||
}) | ||
}) |