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

Commit 6052cfc

Browse files
committed
chore: fix up outside mfs tests
1 parent 98bdff2 commit 6052cfc

File tree

5 files changed

+22
-28
lines changed

5 files changed

+22
-28
lines changed

src/files-mfs/cp.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ module.exports = (createCommon, options) => {
7777
})
7878

7979
it('should copy from outside of mfs', async () => {
80-
const [hash] = ipfs.add(fixtures.smallFile.data)
80+
const [{
81+
hash
82+
}] = await ipfs.add(fixtures.smallFile.data)
8183
const testFilePath = `/${hat()}`
8284
await ipfs.files.cp(`/ipfs/${hash}`, testFilePath)
8385
const testFileData = await ipfs.files.read(testFilePath)

src/files-mfs/ls.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ module.exports = (createCommon, options) => {
9595

9696
it('should ls from outside of mfs', async () => {
9797
const testFileName = hat()
98-
const res = await ipfs.add({ path: `/test/${testFileName}`, content: fixtures.smallFile.data })
99-
const listing = await ipfs.files.ls('/ipfs/' + res[res.length - 1])
98+
const [{
99+
hash
100+
}] = await ipfs.add({ path: `/test/${testFileName}`, content: fixtures.smallFile.data })
101+
const listing = await ipfs.files.ls('/ipfs/' + hash)
100102
expect(listing).to.have.length(1)
101-
expect(listing[0].name).to.equal(testFileName)
103+
expect(listing[0].name).to.equal(hash)
102104
})
103105

104106
it('should list an empty directory', async () => {

src/files-mfs/mv.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
const series = require('async/series')
55
const hat = require('hat')
6-
const { fixtures } = require('../files-regular/utils')
76
const { getDescribe, getIt, expect } = require('../utils/mocha')
87

98
module.exports = (createCommon, options) => {
@@ -77,13 +76,5 @@ module.exports = (createCommon, options) => {
7776
})
7877
})
7978
})
80-
81-
it('should move from outside of mfs', async () => {
82-
const [hash] = ipfs.add(fixtures.smallFile.data)
83-
const testFilePath = `/${hat()}`
84-
await ipfs.files.mv(`/ipfs/${hash}`, testFilePath)
85-
const testFileData = await ipfs.files.read(testFilePath)
86-
expect(testFileData).to.eql(fixtures.smallFile.data)
87-
})
8879
})
8980
}

src/files-mfs/read.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ module.exports = (createCommon, options) => {
6161
})
6262

6363
it('should read from outside of mfs', async () => {
64-
const [hash] = ipfs.add(fixtures.smallFile.data)
64+
const [{
65+
hash
66+
}] = await ipfs.add(fixtures.smallFile.data)
6567
const testFileData = await ipfs.files.read(`/ipfs/${hash}`)
6668
expect(testFileData).to.eql(fixtures.smallFile.data)
6769
})

src/files-mfs/stat.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,18 @@ module.exports = (createCommon, options) => {
132132
})
133133
})
134134

135-
it('should stat outside of mfs', function (done) {
136-
ipfs.files.stat('/ipfs/' + fixtures.smallFile.cid, (err, stat) => {
137-
expect(err).to.not.exist()
138-
expect(stat).to.include({
139-
type: 'file',
140-
blocks: 0,
141-
size: 12,
142-
hash: fixtures.smallFile.cid,
143-
cumulativeSize: 20,
144-
withLocality: false
145-
})
146-
expect(stat.local).to.be.undefined()
147-
expect(stat.sizeLocal).to.be.undefined()
148-
done()
135+
it('should stat outside of mfs', async () => {
136+
const stat = await ipfs.files.stat('/ipfs/' + fixtures.smallFile.cid)
137+
expect(stat).to.include({
138+
type: 'file',
139+
blocks: 0,
140+
size: 12,
141+
hash: fixtures.smallFile.cid,
142+
cumulativeSize: 20,
143+
withLocality: false
149144
})
145+
expect(stat.local).to.be.undefined()
146+
expect(stat.sizeLocal).to.be.undefined()
150147
})
151148
})
152149
}

0 commit comments

Comments
 (0)