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

Commit dbf17a3

Browse files
authored
chore: update ipfs-unixfs-engine dependency (#1523)
* chore: update ipfs-unixfs-engine dependency * fix: test for cid-version=1 and raw-leaves=true * fix: do not default raw leaves option, add CID version test cases The raw leaves option should not be defaulted to false as its value is set to true by unixfs-engine if CID version is set and the user has not specified a value for raw leaves. Also adds tests cases for CID version option with different file sizes. * fix: dnslink for ipfs.io has changed License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 4561f65 commit dbf17a3

File tree

6 files changed

+41
-12
lines changed

6 files changed

+41
-12
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"ipfs-multipart": "~0.1.0",
115115
"ipfs-repo": "~0.23.1",
116116
"ipfs-unixfs": "~0.1.15",
117-
"ipfs-unixfs-engine": "~0.32.1",
117+
"ipfs-unixfs-engine": "~0.32.3",
118118
"ipld": "~0.17.3",
119119
"ipld-dag-cbor": "~0.12.1",
120120
"ipld-dag-pb": "~0.14.6",

src/cli/commands/files/add.js

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ module.exports = {
145145
},
146146
'raw-leaves': {
147147
type: 'boolean',
148-
default: false,
149148
describe: 'Use raw blocks for leaf nodes. (experimental)'
150149
},
151150
'cid-version': {

test/cli/dns.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('dns', () => runOnAndOff((thing) => {
1616
this.timeout(60 * 1000)
1717

1818
return ipfs('dns ipfs.io').then((res) => {
19-
expect(res.substr(0, 6)).to.eql('/ipfs/')
19+
expect(res.substr(0, 6)).to.eql('/ipns/')
2020
})
2121
})
2222
}))

test/cli/files.js

+39-9
Original file line numberDiff line numberDiff line change
@@ -205,33 +205,63 @@ describe('files', () => runOnAndOff((thing) => {
205205
})
206206
})
207207

208-
it('add with cid-version=1', function () {
208+
it('add with cid-version=1 < default max chunk size', function () {
209209
this.timeout(30 * 1000)
210210

211-
return ipfs('add src/init-files/init-docs/readme --cid-version=1')
211+
return ipfs('add test/fixtures/less-than-default-max-chunk-size --cid-version=1')
212212
.then((out) => {
213213
expect(out)
214-
.to.eql('added zdj7WWeQ43G6JJvLWQWZpyHuAMq6uYWRjkBXFad11vE2LHhQ7 readme\n')
214+
.to.eql('added zb2rhh5LdXumxQfNZCqV8pmcC56LX71ERgf2qCNQsmZnwYYx9 less-than-default-max-chunk-size\n')
215215
})
216216
})
217217

218-
it('add with cid-version=1 and raw-leaves=false', function () {
218+
it('add with cid-version=1 > default max chunk size', function () {
219219
this.timeout(30 * 1000)
220220

221-
return ipfs('add src/init-files/init-docs/readme --cid-version=1 --raw-leaves=false')
221+
return ipfs('add test/fixtures/greater-than-default-max-chunk-size --cid-version=1')
222222
.then((out) => {
223223
expect(out)
224-
.to.eql('added zdj7WWeQ43G6JJvLWQWZpyHuAMq6uYWRjkBXFad11vE2LHhQ7 readme\n')
224+
.to.eql('added zdj7WbyyZoWVifUHUe58SNS184PpN8qAuCP6HpAY91iA8CveT greater-than-default-max-chunk-size\n')
225225
})
226226
})
227227

228-
it('add with cid-version=1 and raw-leaves=true', function () {
228+
it('add with cid-version=1 and raw-leaves=false < default max chunk size', function () {
229229
this.timeout(30 * 1000)
230230

231-
return ipfs('add src/init-files/init-docs/readme --cid-version=1 --raw-leaves=true')
231+
return ipfs(`add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=false`)
232232
.then((out) => {
233233
expect(out)
234-
.to.eql('added zdj7WiLc855B1KPRgV7Fh8ivjuAhePE1tuJafmxH5HmmSjqaD readme\n')
234+
.to.eql('added zdj7WWPWpmpFkrWJBhUEZ4QkGumsFsEdkaaEGs7U4dzJraogp less-than-default-max-chunk-size\n')
235+
})
236+
})
237+
238+
it('add with cid-version=1 and raw-leaves=false > default max chunk size', function () {
239+
this.timeout(30 * 1000)
240+
241+
return ipfs(`add test/fixtures/greater-than-default-max-chunk-size --cid-version=1 --raw-leaves=false`)
242+
.then((out) => {
243+
expect(out)
244+
.to.eql('added zdj7WmYojH6vMkDQFNDNwUy2ZawrggqAhS6jjRJwb1C4KXZni greater-than-default-max-chunk-size\n')
245+
})
246+
})
247+
248+
it('add with cid-version=1 and raw-leaves=true < default max chunk size', function () {
249+
this.timeout(30 * 1000)
250+
251+
return ipfs('add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=true')
252+
.then((out) => {
253+
expect(out)
254+
.to.eql('added zb2rhh5LdXumxQfNZCqV8pmcC56LX71ERgf2qCNQsmZnwYYx9 less-than-default-max-chunk-size\n')
255+
})
256+
})
257+
258+
it('add with cid-version=1 and raw-leaves=true > default max chunk size', function () {
259+
this.timeout(30 * 1000)
260+
261+
return ipfs('add test/fixtures/greater-than-default-max-chunk-size --cid-version=1 --raw-leaves=true')
262+
.then((out) => {
263+
expect(out)
264+
.to.eql('added zdj7WbyyZoWVifUHUe58SNS184PpN8qAuCP6HpAY91iA8CveT greater-than-default-max-chunk-size\n')
235265
})
236266
})
237267

Binary file not shown.
888 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)