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

Commit 85024ac

Browse files
committed
lint
1 parent 551db2c commit 85024ac

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

src/cli/commands/files/add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ module.exports = {
143143
alias: 'n',
144144
type: 'boolean',
145145
default: false,
146-
describe: 'Only chunk and hash, do not write to disk'
146+
describe: 'Only chunk and hash, do not write'
147147
},
148148
'enable-sharding-experiment': {
149149
type: 'boolean',

src/http/api/resources/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ exports.add = {
207207
'cid-version': request.query['cid-version'],
208208
'raw-leaves': request.query['raw-leaves'],
209209
progress: request.query.progress ? progressHandler : null,
210-
onlyHash: !!request.query['only-hash']
210+
onlyHash: Boolean(request.query['only-hash'])
211211
}
212212

213213
const aborter = abortable()

test/cli/files.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,14 @@ describe('files', () => runOnAndOff((thing) => {
287287
fs.writeFileSync(filepath, content)
288288

289289
return ipfs(`files add --only-hash ${filepath}`)
290-
.then(hash => {
291-
const speculativeHash = hash.split(' ')[1]
290+
.then(out => {
291+
const hash = out.split(' ')[1]
292+
293+
// 'jsipfs object get <hash>' should time out with the daemon on
294+
// and should fail fast with the daemon off
292295
return Promise.race([
293-
ipfs.fail(`object get ${speculativeHash}`),
294-
new Promise(res => setTimeout(res, 5000))
296+
ipfs.fail(`object get ${hash}`),
297+
new Promise((resolve, reject) => setTimeout(resolve, 4000))
295298
])
296299
.then(() => fs.unlinkSync(filepath))
297300
})

test/http-api/extra/files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-env mocha */
2+
/* eslint max-nested-callbacks: ["error", 8] */
23
'use strict'
34

45
const chai = require('chai')
56
const dirtyChai = require('dirty-chai')
6-
const expect = chai.expect
77
chai.use(dirtyChai)
88

99
module.exports = ctl => {
@@ -22,7 +22,7 @@ module.exports = ctl => {
2222

2323
return Promise.race([
2424
getAttempt,
25-
new Promise(res => setTimeout(res, 4000))
25+
new Promise((resolve, reject) => setTimeout(resolve, 4000))
2626
])
2727
})
2828
})

test/http-api/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const path = require('path')
1414
const clean = require('../utils/clean')
1515

1616
describe('HTTP API', () => {
17-
const repoExample = path.join(__dirname, '..', 'fixtures', 'go-ipfs-repo')
18-
const repoTests = path.join(__dirname, '..', 'repo-tests-run')
17+
const repoExample = path.join(__dirname, '../fixtures/go-ipfs-repo')
18+
const repoTests = path.join(__dirname, '../repo-tests-run')
1919
const http = {}
2020

2121
before(function (done) {

0 commit comments

Comments
 (0)