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

Commit f7ef615

Browse files
committed
chore: use same hashes as go
ipfs-inactive/js-ipfs-unixfs-engine#214 changes the algorithm used when adding files to be more consistent with the go implementation. This means some generated hashes will change. This PR updates those hashes in our test suite.
1 parent 2e40fb8 commit f7ef615

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

test/cli/file.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
const expect = require('chai').expect
55
const runOnAndOff = require('../utils/on-and-off')
66
const file = 'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV'
7-
const dir = 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2'
7+
const dir = 'Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z'
88

99
describe('file ls', () => runOnAndOff((thing) => {
1010
let ipfs
1111

1212
before(function () {
1313
this.timeout(50 * 1000)
1414
ipfs = thing.ipfs
15-
return ipfs('files add -r test/fixtures/test-data/recursive-get-dir')
15+
return ipfs('add -r test/fixtures/test-data/recursive-get-dir')
1616
})
1717

1818
it('prints a filename', () => {
@@ -27,9 +27,9 @@ describe('file ls', () => runOnAndOff((thing) => {
2727
return ipfs(`file ls ${dir}`)
2828
.then((out) => expect(out).to.eql(
2929
`This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.\n` +
30-
'QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9\n' +
30+
'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT\n' +
3131
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN\n' +
32-
'Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz\n' +
32+
'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv\n' +
3333
'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU\n' +
3434
'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV\n'
3535
))

test/cli/files.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ describe('files', () => runOnAndOff((thing) => {
4444
'added QmeiTxVN4xAjxUzHzBqCpK3GaT3GeiLQeJRpYDXDfLeEmR recursive-get-dir/datastore/MANIFEST-000014',
4545
'added QmQpc75sJGUv59dAwHF7vazBGV9o6C7z587Dp9nv7HYAps recursive-get-dir/datastore/LOG.old',
4646
'added QmbFNLNr9at9eK5LrNyUdyE5cdLb5yaT9DkjXw7BK68kcM recursive-get-dir/datastore/LOG',
47-
'added QmfJMCvenrj4SKKRc48DYPxwVdS44qCUCqqtbqhJuSTWXP recursive-get-dir/datastore/LOCK',
47+
'added QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH recursive-get-dir/datastore/LOCK',
4848
'added QmVJi93Yj5RW3NuqqxonGz3jAXUYHrdQvWrURxg1TiLEuX recursive-get-dir/datastore/CURRENT',
4949
'added QmcJ6TXPMPm6puSC9vpxuG57PyfGpr8bvTgkKU9SHHU5Uo recursive-get-dir/datastore/000010.ldb',
5050
'added QmPFVLPmp9zv5Z5KUqLhe2EivAGccQW2r7M7jhVJGLZoZU recursive-get-dir/datastore/000005.ldb',
5151
'added QmfExFwdFKspsY2q5WnhQjd1QDKnjpTQ4UkiHqqQxV7h67 recursive-get-dir/datastore/000002.ldb',
52-
'added Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz recursive-get-dir/datastore',
52+
'added QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv recursive-get-dir/datastore',
5353
'added QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN recursive-get-dir/config',
5454
'added QmbJgQa4XNBFvGQcLbWBNtvWZetbCUKiyAQNfePoTzwf9L recursive-get-dir/blocks/CIQPD/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data',
5555
'added QmSCUPYy4CfFt9nA61J9v2DMfJygQAJjaUcRmygDbVME2D recursive-get-dir/blocks/CIQPD',
@@ -61,8 +61,8 @@ describe('files', () => runOnAndOff((thing) => {
6161
'added Qmec4atiyfysPR8HU5gPfjKY1NpQDY2kmSeeadx8wLEBqY recursive-get-dir/blocks/CIQOM',
6262
'added QmeBypQ2yE4t4Loybhby15DjkeLDXJKCcgMfxTXeFnHa8F recursive-get-dir/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data',
6363
'added Qmd6s8LXAEjW7y9QbGSzeuewrRBYjJHmcazG3Hk7cJ74da recursive-get-dir/blocks/CIQOL',
64-
'added QmfJMCvenrj4SKKRc48DYPxwVdS44qCUCqqtbqhJuSTWXP recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data',
65-
'added QmdiJnDhn4Bb1odByw1BA5qpXssjxgttVz42tpEfo7HNUe recursive-get-dir/blocks/CIQOH',
64+
'added QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data',
65+
'added QmTnaav9VTSVyLu8PvRzh4gJ8heF9rpdWzeDb7rMx5DkxV recursive-get-dir/blocks/CIQOH',
6666
'added Qmc1nasezDdPyZiXB5VB6Aygzswcr6QkauzzXMeUGouHTN recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data',
6767
'added QmeqJBkwmzsVR79HBKLW7AYhfAMxMaJs5dGHSgey5ezy7N recursive-get-dir/blocks/CIQMB',
6868
'added QmaSjzSSRanYzRGPXQY6m5SWfSkkfcnzNkurJEQc4chPJx recursive-get-dir/blocks/CIQLB/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data',
@@ -113,8 +113,8 @@ describe('files', () => runOnAndOff((thing) => {
113113
'added QmSCq2peGvGDXZKuX565UczxRpgzsiPPF3PgcJq9zDbByL recursive-get-dir/blocks/CIQDD',
114114
'added QmdgaiKe1HFfhrZvLwTFCrXmgTojhSWuBvyFXUVc8KzJVc recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data',
115115
'added QmYwUkwNwJN2cevwXKL48DRpbbjbdLWyyLANG3BKTtsTZ8 recursive-get-dir/blocks/CIQBE',
116-
'added QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 recursive-get-dir/blocks',
117-
'added QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2 recursive-get-dir'
116+
'added QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT recursive-get-dir/blocks',
117+
'added Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z recursive-get-dir'
118118
]
119119

120120
before(() => {
@@ -124,7 +124,7 @@ describe('files', () => runOnAndOff((thing) => {
124124
it('add with progress', function () {
125125
this.timeout(30 * 1000)
126126

127-
return ipfs('files add -p src/init-files/init-docs/readme')
127+
return ipfs('add -p src/init-files/init-docs/readme')
128128
.then((out) => {
129129
expect(out)
130130
.to.eql('added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB readme\n')
@@ -134,7 +134,7 @@ describe('files', () => runOnAndOff((thing) => {
134134
it('add', function () {
135135
this.timeout(30 * 1000)
136136

137-
return ipfs('files add src/init-files/init-docs/readme')
137+
return ipfs('add src/init-files/init-docs/readme')
138138
.then((out) => {
139139
expect(out)
140140
.to.eql('added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB readme\n')
@@ -154,7 +154,7 @@ describe('files', () => runOnAndOff((thing) => {
154154
it('add recursively test', function () {
155155
this.timeout(60 * 1000)
156156

157-
return ipfs('files add -r test/fixtures/test-data/recursive-get-dir')
157+
return ipfs('add -r test/fixtures/test-data/recursive-get-dir')
158158
.then((out) => {
159159
expect(out).to.eql(recursiveGetDirResults.join('\n') + '\n')
160160
})
@@ -163,7 +163,7 @@ describe('files', () => runOnAndOff((thing) => {
163163
it('add directory with trailing slash test', function () {
164164
this.timeout(30 * 1000)
165165

166-
return ipfs('files add -r test/fixtures/test-data/recursive-get-dir/')
166+
return ipfs('add -r test/fixtures/test-data/recursive-get-dir/')
167167
.then((out) => {
168168
expect(out).to.eql(recursiveGetDirResults.join('\n') + '\n')
169169
})
@@ -177,7 +177,7 @@ describe('files', () => runOnAndOff((thing) => {
177177
'added QmXJGoo27bg7ExNAtr9vRcivxDwcfHtkxatGno9HrUdR16 odd-name-[v0]'
178178
]
179179

180-
return ipfs('files add -r test/fixtures/odd-name-[v0]')
180+
return ipfs('add -r test/fixtures/odd-name-[v0]')
181181
.then((out) => {
182182
expect(out).to.eql(expected.join('\n') + '\n')
183183
})
@@ -258,7 +258,7 @@ describe('files', () => runOnAndOff((thing) => {
258258
it('add --quiet', function () {
259259
this.timeout(30 * 1000)
260260

261-
return ipfs('files add -q src/init-files/init-docs/readme')
261+
return ipfs('add -q src/init-files/init-docs/readme')
262262
.then((out) => {
263263
expect(out)
264264
.to.eql('added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB\n')
@@ -268,7 +268,7 @@ describe('files', () => runOnAndOff((thing) => {
268268
it('add --quieter', function () {
269269
this.timeout(30 * 1000)
270270

271-
return ipfs('files add -Q -w test/fixtures/test-data/hello test/test-data/node.json')
271+
return ipfs('add -Q -w test/fixtures/test-data/hello test/test-data/node.json')
272272
.then((out) => {
273273
expect(out)
274274
.to.eql('QmYRMUVULBfj7WrdPESnwnyZmtayN6Sdrwh1nKcQ9QgQeZ\n')
@@ -278,15 +278,15 @@ describe('files', () => runOnAndOff((thing) => {
278278
it('add --silent', function () {
279279
this.timeout(30 * 1000)
280280

281-
return ipfs('files add --silent src/init-files/init-docs/readme')
281+
return ipfs('add --silent src/init-files/init-docs/readme')
282282
.then((out) => {
283283
expect(out)
284284
.to.eql('')
285285
})
286286
})
287287

288288
it('add --only-hash outputs correct hash', function () {
289-
return ipfs('files add --only-hash src/init-files/init-docs/readme')
289+
return ipfs('add --only-hash src/init-files/init-docs/readme')
290290
.then(out =>
291291
expect(out)
292292
.to.eql('added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB readme\n')
@@ -330,7 +330,7 @@ describe('files', () => runOnAndOff((thing) => {
330330
it('cat', function () {
331331
this.timeout(30 * 1000)
332332

333-
return ipfs('files cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
333+
return ipfs('cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
334334
.then((out) => {
335335
expect(out).to.eql(readme)
336336
})
@@ -348,7 +348,7 @@ describe('files', () => runOnAndOff((thing) => {
348348
it('cat part of a file using `count`', function () {
349349
this.timeout(30 * 1000)
350350

351-
return ipfs('files cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB --offset 21 --count 5')
351+
return ipfs('cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB --offset 21 --count 5')
352352
.then((out) => {
353353
expect(out).to.eql(readme.substring(21, 26))
354354
})
@@ -357,7 +357,7 @@ describe('files', () => runOnAndOff((thing) => {
357357
it('cat part of a file using `length`', function () {
358358
this.timeout(30 * 1000)
359359

360-
return ipfs('files cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB --offset 21 --length 5')
360+
return ipfs('cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB --offset 21 --length 5')
361361
.then((out) => {
362362
expect(out).to.eql(readme.substring(21, 26))
363363
})
@@ -374,7 +374,7 @@ describe('files', () => runOnAndOff((thing) => {
374374
it('get', function () {
375375
this.timeout(20 * 1000)
376376

377-
return ipfs('files get QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
377+
return ipfs('get QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
378378
.then((out) => {
379379
expect(out)
380380
.to.eql('Saving file(s) QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB\n')
@@ -406,16 +406,16 @@ describe('files', () => runOnAndOff((thing) => {
406406
it('get recursively', function () {
407407
this.timeout(20 * 1000)
408408

409-
const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
409+
const outDir = path.join(process.cwd(), 'Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z')
410410
rimraf(outDir)
411411

412-
return ipfs('files get QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
412+
return ipfs('get Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z')
413413
.then((out) => {
414414
expect(out).to.eql(
415-
'Saving file(s) QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2\n'
415+
'Saving file(s) Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z\n'
416416
)
417417

418-
const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
418+
const outDir = path.join(process.cwd(), 'Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z')
419419
const expectedDir = path.join(process.cwd(), 'test', 'fixtures', 'test-data', 'recursive-get-dir')
420420

421421
const compareResult = compareDir(outDir, expectedDir, {

test/cli/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('init', function () {
4242

4343
// Test that the following was written when init-ing the repo
4444
// jsipfs files cat /ipfs/QmfGBRT6BbWJd7yUc2uYdaUZJBbnEFvTqehPFoSMQ6wgdr/readme
45-
let command = out.substring(out.indexOf('files cat'), out.length - 2 /* omit the newline char */)
45+
let command = out.substring(out.indexOf('cat'), out.length - 2 /* omit the newline char */)
4646
return ipfs(command)
4747
}).then((out) => expect(out).to.equal(readme))
4848
})

test/cli/ls.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ describe('ls', () => runOnAndOff((thing) => {
99

1010
before(() => {
1111
ipfs = thing.ipfs
12-
return ipfs('files add -r test/fixtures/test-data/recursive-get-dir')
12+
return ipfs('add -r test/fixtures/test-data/recursive-get-dir')
1313
})
1414

1515
it('prints added files', function () {
1616
this.timeout(20 * 1000)
17-
return ipfs('ls QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
17+
return ipfs('ls Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z')
1818
.then((out) => {
1919
expect(out).to.eql(
20-
'QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 123530 blocks/\n' +
20+
'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT 123530 blocks/\n' +
2121
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN 3939 config\n' +
22-
'Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz 5503 datastore/\n' +
22+
'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv 5503 datastore/\n' +
2323
'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU 7397 init-docs/\n' +
2424
'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV 10 version\n'
2525
)
@@ -38,13 +38,13 @@ describe('ls', () => runOnAndOff((thing) => {
3838

3939
it('adds a header, -v', function () {
4040
this.timeout(20 * 1000)
41-
return ipfs('ls /ipfs/QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2 -v')
41+
return ipfs('ls /ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z -v')
4242
.then((out) => {
4343
expect(out).to.eql(
4444
'Hash Size Name\n' +
45-
'QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 123530 blocks/\n' +
45+
'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT 123530 blocks/\n' +
4646
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN 3939 config\n' +
47-
'Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz 5503 datastore/\n' +
47+
'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv 5503 datastore/\n' +
4848
'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU 7397 init-docs/\n' +
4949
'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV 10 version\n'
5050
)
@@ -54,7 +54,7 @@ describe('ls', () => runOnAndOff((thing) => {
5454
it('follows a path, <hash>/<subdir>', function () {
5555
this.timeout(20 * 1000)
5656

57-
return ipfs('ls /ipfs/QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2/init-docs')
57+
return ipfs('ls /ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs')
5858
.then((out) => {
5959
expect(out).to.eql(
6060
'QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V 1688 about\n' +
@@ -73,7 +73,7 @@ describe('ls', () => runOnAndOff((thing) => {
7373
this.slow(2000)
7474
this.timeout(20 * 1000)
7575

76-
return ipfs('ls -r /ipfs/QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2/init-docs')
76+
return ipfs('ls -r /ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs')
7777
.then(out => {
7878
expect(out).to.eql(
7979
'QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V 1688 about\n' +

0 commit comments

Comments
 (0)