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

Commit 1a70af6

Browse files
committed
chore: fix sinon spys in browser tests
1 parent cd570b7 commit 1a70af6

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

src/exporter/file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = (node, name, path, pathRest, resolve, size, dag, parent, depth,
3030
}
3131

3232
if (length === 0) {
33-
return pull.empty()
33+
return pull.once(Buffer.alloc(0))
3434
}
3535

3636
if (!offset) {
@@ -56,7 +56,7 @@ module.exports = (node, name, path, pathRest, resolve, size, dag, parent, depth,
5656

5757
function streamBytes (dag, node, fileSize, offset, length) {
5858
if (offset === fileSize || length === 0) {
59-
return pull.empty()
59+
return pull.once(Buffer.alloc(0))
6060
}
6161

6262
const end = offset + length

test/exporter.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,8 @@ module.exports = (repo) => {
8282
pull(
8383
input,
8484
pull.map((file) => {
85-
const ipfsPath = `${path.join(dirName, file.substring(directory.length))}`
86-
8785
return {
88-
path: ipfsPath,
86+
path: path.join(dirName, path.basename(file)),
8987
content: toPull.source(fs.createReadStream(file))
9088
}
9189
}),

test/importer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const extend = require('deep-extend')
77
const chai = require('chai')
88
chai.use(require('dirty-chai'))
99
const expect = chai.expect
10-
const sinon = require('sinon')
10+
const spy = require('sinon/lib/sinon/spy')
1111
const BlockService = require('ipfs-block-service')
1212
const pull = require('pull-stream')
1313
const mh = require('multihashes')
@@ -456,7 +456,7 @@ module.exports = (repo) => {
456456
})
457457

458458
it('will call an optional progress function', (done) => {
459-
options.progress = sinon.spy()
459+
options.progress = spy()
460460

461461
pull(
462462
pull.values([{

test/node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const mkdirp = require('mkdirp')
1010
const series = require('async/series')
1111

1212
describe('IPFS UnixFS Engine', () => {
13-
const repoExample = path.join(process.cwd(), '/test/test-repo')
14-
const repoTests = path.join(os.tmpdir(), '/unixfs-tests-' + Date.now())
13+
const repoExample = path.join(process.cwd(), 'test', 'test-repo')
14+
const repoTests = path.join(os.tmpdir(), 'unixfs-tests-' + Date.now())
1515

1616
const repo = new IPFSRepo(repoTests)
1717

0 commit comments

Comments
 (0)