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

Commit 4b70dc6

Browse files
committed
fix: moves tests to interface-core and removes path from output
`ipns name resolve` dns tests moved to interface-core resolve call now return a string as per documention
1 parent fe85248 commit 4b70dc6

File tree

3 files changed

+7
-50
lines changed

3 files changed

+7
-50
lines changed

src/core/ipns/index.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ class IPNS {
7777
const result = this.cache.get(id)
7878

7979
if (result) {
80-
return callback(null, {
81-
path: result
82-
})
80+
return callback(null, result)
8381
}
8482
}
8583

@@ -91,9 +89,7 @@ class IPNS {
9189

9290
log(`IPNS record from ${name} was resolved correctly`)
9391

94-
callback(null, {
95-
path: result
96-
})
92+
callback(null, result)
9793
})
9894
}
9995

src/http/api/resources/name.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ exports.resolve = {
1717
const res = await ipfs.name.resolve(arg, request.query)
1818

1919
return h.response({
20-
Path: res.path
20+
Path: res
2121
})
2222
}
2323
}

test/core/name.js

+4-43
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const publishAndResolve = (publisher, resolver, ipfsRef, publishOpts, nodeId, re
3434
expect(err).to.not.exist()
3535
expect(res[0]).to.exist()
3636
expect(res[1]).to.exist()
37-
expect(res[1].path).to.equal(ipfsRef)
37+
expect(res[1]).to.equal(ipfsRef)
3838
callback()
3939
})
4040
}
@@ -117,7 +117,7 @@ describe('name', function () {
117117
], (err, res) => {
118118
expect(err).to.not.exist()
119119
expect(res[2]).to.exist()
120-
expect(res[2].path).to.equal(ipfsRef)
120+
expect(res[2]).to.equal(ipfsRef)
121121
done()
122122
})
123123
})
@@ -136,7 +136,7 @@ describe('name', function () {
136136
], (err, res) => {
137137
expect(err).to.not.exist()
138138
expect(res[2]).to.exist()
139-
expect(res[2].path).to.equal(`/ipns/${nodeId}`)
139+
expect(res[2]).to.equal(`/ipns/${nodeId}`)
140140
done()
141141
})
142142
})
@@ -277,7 +277,7 @@ describe('name', function () {
277277
], (err, res) => {
278278
expect(err).to.not.exist()
279279
expect(res[2]).to.exist()
280-
expect(res[2].path).to.equal(ipfsRef)
280+
expect(res[2]).to.equal(ipfsRef)
281281
done()
282282
})
283283
})
@@ -618,43 +618,4 @@ describe('name', function () {
618618
done()
619619
})
620620
})
621-
622-
describe('working with dns', function () {
623-
let node
624-
let ipfsd
625-
626-
before(function (done) {
627-
df.spawn({
628-
exec: IPFS,
629-
args: [`--pass ${hat()}`, '--offline'],
630-
config: { Bootstrap: [] }
631-
}, (err, _ipfsd) => {
632-
expect(err).to.not.exist()
633-
ipfsd = _ipfsd
634-
node = _ipfsd.api
635-
done()
636-
})
637-
})
638-
639-
after((done) => ipfsd.stop(done))
640-
641-
it('should resolve ipfs.io', async () => {
642-
const r = await node.name.resolve('ipfs.io', { recursive: false })
643-
return expect(r).to.eq('/ipns/website.ipfs.io')
644-
})
645-
646-
it('should resolve /ipns/ipfs.io recursive', async () => {
647-
const r = await node.name.resolve('ipfs.io', { recursive: true })
648-
649-
return expect(r.substr(0, 6)).to.eql('/ipfs/')
650-
})
651-
652-
it('should fail to resolve /ipns/ipfs.a', async () => {
653-
try {
654-
await node.name.resolve('ipfs.a')
655-
} catch (err) {
656-
expect(err).to.exist()
657-
}
658-
})
659-
})
660621
})

0 commit comments

Comments
 (0)