Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit f51d747

Browse files
committed
fix: make recursive true by default
1 parent fb149cc commit f51d747

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/name/resolve.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ module.exports = (createCommon, options) => {
3131

3232
after((done) => common.teardown(done))
3333

34-
// This test should be changed to the recursive logic when recursive === true is the default
3534
it('should resolve a record default options', async () => {
3635
const [{ path }] = await ipfs.add(Buffer.from('should resolve a record default options'))
36+
37+
const { id: keyId } = await ipfs.key.gen('key-name-default', { type: 'rsa', size: 2048 })
38+
3739
await ipfs.name.publish(path, { 'allow-offline': true })
38-
return expect(ipfs.name.resolve(`/ipns/${nodeId}`))
40+
await ipfs.name.publish(`/ipns/${nodeId}`, { 'allow-offline': true, key: 'key-name-default' })
41+
42+
return expect(ipfs.name.resolve(`/ipns/${keyId}`))
3943
.to.become(`/ipfs/${path}`)
4044
})
4145

@@ -58,12 +62,16 @@ module.exports = (createCommon, options) => {
5862
.to.become(`/ipfs/${path}`)
5963
})
6064

61-
// This test should be changed to the recursive logic when recursive === true is the default
6265
it('should resolve a record default options with remainder', async () => {
63-
const [{ path }] = await ipfs.add(Buffer.from('should resolve a record with the default params with remainder'))
66+
const [{ path }] = await ipfs.add(Buffer.from('should resolve a record default options with remainder'))
67+
68+
const { id: keyId } = await ipfs.key.gen('key-name-remainder-default', { type: 'rsa', size: 2048 })
69+
6470
await ipfs.name.publish(path, { 'allow-offline': true })
65-
return expect(ipfs.name.resolve(`/ipns/${nodeId}/remainder/file.txt`))
66-
.to.become(`/ipfs/${path}/remainder/file.txt`)
71+
await ipfs.name.publish(`/ipns/${nodeId}`, { 'allow-offline': true, key: 'key-name-remainder-default' })
72+
73+
return expect(ipfs.name.resolve(`/ipns/${keyId}/remainder/file.txt`))
74+
.to.be.eventually.equal(`/ipfs/${path}/remainder/file.txt`)
6775
})
6876

6977
it('should resolve a record recursive === false with remainder', async () => {
@@ -122,10 +130,9 @@ module.exports = (createCommon, options) => {
122130

123131
after((done) => common.teardown(done))
124132

125-
// This test should be changed to the recursive logic when recursive === true is the default
126133
it('should resolve /ipns/ipfs.io', async () => {
127134
return expect(ipfs.name.resolve('/ipns/ipfs.io'))
128-
.to.eventually.match(/\/ipns\/.+$/)
135+
.to.eventually.match(/\/ipfs\/.+$/)
129136
})
130137

131138
it('should resolve /ipns/ipfs.io recursive === false', async () => {
@@ -138,10 +145,9 @@ module.exports = (createCommon, options) => {
138145
.to.eventually.match(/\/ipfs\/.+$/)
139146
})
140147

141-
// This test should be changed to the recursive logic when recursive === true is the default
142148
it('should resolve /ipns/ipfs.io with remainder', async () => {
143149
return expect(ipfs.name.resolve('/ipns/ipfs.io/images/ipfs-logo.svg'))
144-
.to.eventually.match(/\/ipns\/.+\/images\/ipfs-logo.svg$/)
150+
.to.eventually.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/)
145151
})
146152

147153
it('should resolve /ipns/ipfs.io with remainder recursive === false', async () => {

0 commit comments

Comments
 (0)