From daf40cbdeadebc07234db79715be3aad12a4539e Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 25 Sep 2019 10:16:38 +0100 Subject: [PATCH] chore: fix linting --- src/cli/commands/daemon.js | 2 +- src/cli/commands/file/ls.js | 2 +- src/cli/commands/init.js | 2 +- src/cli/commands/version.js | 4 +- src/core/components/pin/gc.js | 2 +- src/core/components/pin/pin-manager.js | 2 +- src/core/config.js | 2 +- src/core/ipns/publisher.js | 12 ++-- src/core/ipns/republisher.js | 2 +- src/core/ipns/resolver.js | 4 +- test/cli/file.js | 4 +- test/cli/files.js | 4 +- test/cli/gc.js | 6 +- test/cli/name.js | 4 +- test/cli/swarm.js | 4 +- test/core/bitswap.spec.js | 2 +- test/core/circuit-relay.js | 2 +- test/core/pin-set.js | 2 +- test/core/pin.js | 78 +++++++++++++++++--------- test/core/utils.js | 4 +- test/gateway/index.js | 2 +- test/http-api/files.js | 22 ++++---- test/http-api/inject/bootstrap.js | 4 +- test/http-api/inject/dht.js | 10 ++-- test/http-api/inject/name.js | 2 +- test/http-api/inject/pin.js | 12 ++-- test/http-api/inject/ping.js | 6 +- test/http-api/inject/pubsub.js | 6 +- 28 files changed, 117 insertions(+), 91 deletions(-) diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index a0b4aa0c8b..cfe48d44d1 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -80,7 +80,7 @@ module.exports = { print('Daemon is ready') const cleanup = async () => { - print(`Received interrupt signal, shutting down...`) + print('Received interrupt signal, shutting down...') await daemon.stop() process.exit(0) } diff --git a/src/cli/commands/file/ls.js b/src/cli/commands/file/ls.js index 2469245d47..20be00c5cc 100644 --- a/src/cli/commands/file/ls.js +++ b/src/cli/commands/file/ls.js @@ -11,7 +11,7 @@ module.exports = { argv.resolve((async () => { const path = argv.key // `ipfs file ls` is deprecated. See https://ipfs.io/docs/commands/#ipfs-file-ls - argv.print(`This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.`) + argv.print('This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.') const ipfs = await argv.getIpfs() let links = await ipfs.ls(path) diff --git a/src/cli/commands/init.js b/src/cli/commands/init.js index 78095d25e4..5b41f8afe3 100644 --- a/src/cli/commands/init.js +++ b/src/cli/commands/init.js @@ -57,7 +57,7 @@ module.exports = { }) } catch (err) { if (err.code === 'EACCES') { - err.message = `EACCES: permission denied, stat $IPFS_PATH/version` + err.message = 'EACCES: permission denied, stat $IPFS_PATH/version' } throw err } diff --git a/src/cli/commands/version.js b/src/cli/commands/version.js index 1af4737059..63a8864a25 100644 --- a/src/cli/commands/version.js +++ b/src/cli/commands/version.js @@ -17,12 +17,12 @@ module.exports = { commit: { type: 'boolean', default: false, - describe: `Include the version's commit hash` + describe: 'Include the version\'s commit hash' }, repo: { type: 'boolean', default: false, - describe: `Print only the repo's version number` + describe: 'Print only the repo\'s version number' }, all: { type: 'boolean', diff --git a/src/core/components/pin/gc.js b/src/core/components/pin/gc.js index 9f8714abcc..5615d3ea3d 100644 --- a/src/core/components/pin/gc.js +++ b/src/core/components/pin/gc.js @@ -77,7 +77,7 @@ function createMarkedSet (ipfs, callback) { (cb) => ipfs._repo.root.get(MFS_ROOT_KEY, (err, mh) => { if (err) { if (err.code === 'ERR_NOT_FOUND') { - log(`No blocks in MFS`) + log('No blocks in MFS') return cb(null, []) } return cb(expErr(err, 'Could not get MFS root from datastore')) diff --git a/src/core/components/pin/pin-manager.js b/src/core/components/pin/pin-manager.js index 096980fcec..a55f9d28d5 100644 --- a/src/core/components/pin/pin-manager.js +++ b/src/core/components/pin/pin-manager.js @@ -274,7 +274,7 @@ class PinManager { this.repo.datastore.get(PIN_DS_KEY, (err, mh) => { if (err) { if (err.code === 'ERR_NOT_FOUND') { - this.log(`No pinned blocks`) + this.log('No pinned blocks') return callback(null, []) } return callback(new Error(`Could not get pin sets root from datastore: ${err.message}`)) diff --git a/src/core/config.js b/src/core/config.js index ba419d47a8..beb1d149f8 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -21,7 +21,7 @@ const s = superstruct({ return true }, - 'multiaddr-ipfs': v => mafmt.IPFS.matches(v) ? true : `multiaddr IPFS invalid` + 'multiaddr-ipfs': v => mafmt.IPFS.matches(v) ? true : 'multiaddr IPFS invalid' } }) diff --git a/src/core/ipns/publisher.js b/src/core/ipns/publisher.js index 67c91fa180..20d8045f28 100644 --- a/src/core/ipns/publisher.js +++ b/src/core/ipns/publisher.js @@ -48,7 +48,7 @@ class IpnsPublisher { _putRecordToRouting (record, peerId, callback) { if (!(PeerId.isPeerId(peerId))) { - const errMsg = `peerId received is not valid` + const errMsg = 'peerId received is not valid' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID')) @@ -87,7 +87,7 @@ class IpnsPublisher { _publishEntry (key, entry, peerId, callback) { if (!(Key.isKey(key))) { - const errMsg = `datastore key does not have a valid format` + const errMsg = 'datastore key does not have a valid format' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_DATASTORE_KEY')) @@ -118,14 +118,14 @@ class IpnsPublisher { _publishPublicKey (key, publicKey, peerId, callback) { if ((!Key.isKey(key))) { - const errMsg = `datastore key does not have a valid format` + const errMsg = 'datastore key does not have a valid format' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_DATASTORE_KEY')) } if (!publicKey || !publicKey.bytes) { - const errMsg = `one or more of the provided parameters are not defined` + const errMsg = 'one or more of the provided parameters are not defined' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_UNDEFINED_PARAMETER')) @@ -149,7 +149,7 @@ class IpnsPublisher { // If `checkRouting` is true and we have no existing record, this method will check the routing system for any existing records. _getPublished (peerId, options, callback) { if (!(PeerId.isPeerId(peerId))) { - const errMsg = `peerId received is not valid` + const errMsg = 'peerId received is not valid' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID')) @@ -209,7 +209,7 @@ class IpnsPublisher { _updateOrCreateRecord (privKey, value, validity, peerId, callback) { if (!(PeerId.isPeerId(peerId))) { - const errMsg = `peerId received is not valid` + const errMsg = 'peerId received is not valid' log.error(errMsg) return callback(errcode(new Error(errMsg), 'ERR_INVALID_PEER_ID')) diff --git a/src/core/ipns/republisher.js b/src/core/ipns/republisher.js index 9fef7b3300..b71a19cb6d 100644 --- a/src/core/ipns/republisher.js +++ b/src/core/ipns/republisher.js @@ -167,7 +167,7 @@ class IpnsRepublisher { record = ipns.unmarshal(dsVal) } catch (err) { log.error(err) - return callback(errcode(new Error(`found ipns record that we couldn't convert to a value`), 'ERR_INVALID_IPNS_RECORD')) + return callback(errcode(new Error('found ipns record that we couldn\'t convert to a value'), 'ERR_INVALID_IPNS_RECORD')) } callback(null, record.value) diff --git a/src/core/ipns/resolver.js b/src/core/ipns/resolver.js index 5d6385b198..125f228eed 100644 --- a/src/core/ipns/resolver.js +++ b/src/core/ipns/resolver.js @@ -108,7 +108,7 @@ class IpnsResolver { ipnsEntry = ipns.unmarshal(record) } catch (err) { log.error(err) - return callback(errcode(new Error(`found ipns record that we couldn't convert to a value`), 'ERR_INVALID_RECORD_RECEIVED')) + return callback(errcode(new Error('found ipns record that we couldn\'t convert to a value'), 'ERR_INVALID_RECORD_RECEIVED')) } // if the record has a public key validate it @@ -131,7 +131,7 @@ class IpnsResolver { peerId.pubKey = crypto.keys.unmarshalPublicKey(pubKey) } catch (err) { log.error(err) - return callback(errcode(new Error(`found public key record that we couldn't convert to a value`), 'ERR_INVALID_PUB_KEY_RECEIVED')) + return callback(errcode(new Error('found public key record that we couldn\'t convert to a value'), 'ERR_INVALID_PUB_KEY_RECEIVED')) } this._validateRecord(peerId, ipnsEntry, callback) diff --git a/test/cli/file.js b/test/cli/file.js index e4a5e0c9ce..261c4c0777 100644 --- a/test/cli/file.js +++ b/test/cli/file.js @@ -18,7 +18,7 @@ describe('file ls', () => runOnAndOff((thing) => { it('prints a filename', () => { return ipfs(`file ls ${file}`) .then((out) => expect(out).to.eql( - `This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.\n` + + 'This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.\n' + `${file}\n` )) }) @@ -26,7 +26,7 @@ describe('file ls', () => runOnAndOff((thing) => { it('prints the filenames in a directory', () => { return ipfs(`file ls ${dir}`) .then((out) => expect(out).to.eql( - `This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.\n` + + 'This functionality is deprecated, and will be removed in future versions. If possible, please use \'ipfs ls\' instead.\n' + 'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT\n' + 'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN\n' + 'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv\n' + diff --git a/test/cli/files.js b/test/cli/files.js index 5e266a9d4a..473ca81f61 100644 --- a/test/cli/files.js +++ b/test/cli/files.js @@ -246,7 +246,7 @@ describe('files', () => runOnAndOff((thing) => { it('add with cid-version=1 and raw-leaves=false < default max chunk size', function () { this.timeout(30 * 1000) - return ipfs(`add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=false`) + return ipfs('add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=false') .then((out) => { expect(out) .to.eql('added bafybeiaoh5okvpnuhndsz4kgdhulnkm566rz7w7il6r2zm6wxu5f5uqlsu less-than-default-max-chunk-size\n') @@ -256,7 +256,7 @@ describe('files', () => runOnAndOff((thing) => { it('add with cid-version=1 and raw-leaves=false > default max chunk size', function () { this.timeout(30 * 1000) - return ipfs(`add test/fixtures/greater-than-default-max-chunk-size --cid-version=1 --raw-leaves=false`) + return ipfs('add test/fixtures/greater-than-default-max-chunk-size --cid-version=1 --raw-leaves=false') .then((out) => { expect(out) .to.eql('added bafybeiajpcrr2qglyeq3biilzt25ty6kpjs7huy2lfxopqfke6riaaxnim greater-than-default-max-chunk-size\n') diff --git a/test/cli/gc.js b/test/cli/gc.js index d66c82f56d..cf11a0115a 100644 --- a/test/cli/gc.js +++ b/test/cli/gc.js @@ -34,7 +34,7 @@ describe('gc', () => { const errMsg = 'some err' const printSpy = setupMocks(cids, errMsg) - await cli.parse(`repo gc`) + await cli.parse('repo gc') const exp = cids.map(c => 'removed ' + c).concat(errMsg) for (let i = 0; i < exp.length; i++) { @@ -49,7 +49,7 @@ describe('gc', () => { ] const printSpy = setupMocks(cids) - await cli.parse(`repo gc --quiet`) + await cli.parse('repo gc --quiet') const exp = cids.map(c => c.toString()) for (let i = 0; i < exp.length; i++) { @@ -60,7 +60,7 @@ describe('gc', () => { it('gc with --stream-errors=false does not print errors', async () => { const printSpy = setupMocks([], 'some err') - await cli.parse(`repo gc --stream-errors=false`) + await cli.parse('repo gc --stream-errors=false') sinon.assert.notCalled(printSpy) }) }) diff --git a/test/cli/name.js b/test/cli/name.js index 984d777da8..19f897d360 100644 --- a/test/cli/name.js +++ b/test/cli/name.js @@ -31,7 +31,7 @@ describe('name', () => { // Force the next require to not use require cache clearModule('../../src/cli/commands/name/resolve.js') - await cli.parse(`name resolve test`) + await cli.parse('name resolve test') sinon.assert.calledWith(resolveFake, 'test', { nocache: false, recursive: true }) }) @@ -47,7 +47,7 @@ describe('name', () => { // Force the next require to not use require cache clearModule('../../src/cli/commands/name/publish.js') - await cli.parse(`name publish test --silent`) + await cli.parse('name publish test --silent') sinon.assert.calledWith(printSpy, 'Published to name: value') sinon.assert.calledWith(publishFake, 'test', { resolve: true, diff --git a/test/cli/swarm.js b/test/cli/swarm.js index 137661f84e..c8c0206e3a 100644 --- a/test/cli/swarm.js +++ b/test/cli/swarm.js @@ -128,8 +128,8 @@ describe('swarm', () => { promise.then(({ data }) => { expect(data).to.eql([ `${peerInfo.id.toB58String()} (2)`, - `\t/ip4/127.0.0.1/tcp/4001`, - `\t/ip4/127.0.0.1/tcp/4001/ws` + '\t/ip4/127.0.0.1/tcp/4001', + '\t/ip4/127.0.0.1/tcp/4001/ws' ].join('\n')) done() }) diff --git a/test/core/bitswap.spec.js b/test/core/bitswap.spec.js index 236605c4da..68506b29c6 100644 --- a/test/core/bitswap.spec.js +++ b/test/core/bitswap.spec.js @@ -70,7 +70,7 @@ function addNode (fDaemon, inProcNode, callback) { initOptions: { bits: 512 }, config: { Addresses: { - Swarm: [`/ip4/127.0.0.1/tcp/0/ws`] + Swarm: ['/ip4/127.0.0.1/tcp/0/ws'] }, Discovery: { MDNS: { diff --git a/test/core/circuit-relay.js b/test/core/circuit-relay.js index c23e75faa2..6d58176910 100644 --- a/test/core/circuit-relay.js +++ b/test/core/circuit-relay.js @@ -57,7 +57,7 @@ const wsAddr = (addrs) => addrs.map((a) => a.toString()).find((a) => a.includes( const tcpAddr = (addrs) => addrs.map((a) => a.toString()).find((a) => !a.includes('/ws')) describe('circuit relay', () => { - describe(`A <-> R <-> B`, function () { + describe('A <-> R <-> B', function () { this.timeout(80 * 1000) let nodeA diff --git a/test/core/pin-set.js b/test/core/pin-set.js index 180c32167f..21c66259b2 100644 --- a/test/core/pin-set.js +++ b/test/core/pin-set.js @@ -183,7 +183,7 @@ describe('pinSet', function () { }) describe('walkItems', function () { - it(`fails if node doesn't have a pin-set protobuf header`, function (done) { + it('fails if node doesn\'t have a pin-set protobuf header', function (done) { createNode('datum', (err, node) => { expect(err).to.not.exist() diff --git a/test/core/pin.js b/test/core/pin.js index 585cda104c..b789024b24 100644 --- a/test/core/pin.js +++ b/test/core/pin.js @@ -240,14 +240,22 @@ describe('pin', function () { return pin.ls() .then(out => expect(out).to.deep.include.members([ - { type: 'recursive', - hash: 'QmTAMavb995EHErSrKo7mB8dYkpaSJxu6ys1a6XJyB2sys' }, - { type: 'indirect', - hash: 'QmTMbkDfvHwq3Aup6Nxqn3KKw9YnoKzcZvuArAfQ9GF3QG' }, - { type: 'indirect', - hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' }, - { type: 'indirect', - hash: 'QmVgSHAdMxFAuMP2JiMAYkB8pCWP1tcB9djqvq8GKAFiHi' } + { + type: 'recursive', + hash: 'QmTAMavb995EHErSrKo7mB8dYkpaSJxu6ys1a6XJyB2sys' + }, + { + type: 'indirect', + hash: 'QmTMbkDfvHwq3Aup6Nxqn3KKw9YnoKzcZvuArAfQ9GF3QG' + }, + { + type: 'indirect', + hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' + }, + { + type: 'indirect', + hash: 'QmVgSHAdMxFAuMP2JiMAYkB8pCWP1tcB9djqvq8GKAFiHi' + } ]) ) }) @@ -256,8 +264,10 @@ describe('pin', function () { return pin.ls({ type: 'direct' }) .then(out => expect(out).to.deep.include.members([ - { type: 'direct', - hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' } + { + type: 'direct', + hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' + } ]) ) }) @@ -266,8 +276,10 @@ describe('pin', function () { return pin.ls({ type: 'recursive' }) .then(out => expect(out).to.deep.include.members([ - { type: 'recursive', - hash: 'QmTAMavb995EHErSrKo7mB8dYkpaSJxu6ys1a6XJyB2sys' } + { + type: 'recursive', + hash: 'QmTAMavb995EHErSrKo7mB8dYkpaSJxu6ys1a6XJyB2sys' + } ]) ) }) @@ -276,12 +288,18 @@ describe('pin', function () { return pin.ls({ type: 'indirect' }) .then(out => expect(out).to.deep.include.members([ - { type: 'indirect', - hash: 'QmTMbkDfvHwq3Aup6Nxqn3KKw9YnoKzcZvuArAfQ9GF3QG' }, - { type: 'indirect', - hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' }, - { type: 'indirect', - hash: 'QmVgSHAdMxFAuMP2JiMAYkB8pCWP1tcB9djqvq8GKAFiHi' } + { + type: 'indirect', + hash: 'QmTMbkDfvHwq3Aup6Nxqn3KKw9YnoKzcZvuArAfQ9GF3QG' + }, + { + type: 'indirect', + hash: 'QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' + }, + { + type: 'indirect', + hash: 'QmVgSHAdMxFAuMP2JiMAYkB8pCWP1tcB9djqvq8GKAFiHi' + } ]) ) }) @@ -290,8 +308,10 @@ describe('pin', function () { return pin.ls(pins.mercuryDir, { type: 'direct' }) .then(out => expect(out).to.have.deep.members([ - { type: 'direct', - hash: pins.mercuryDir } + { + type: 'direct', + hash: pins.mercuryDir + } ]) ) }) @@ -300,8 +320,10 @@ describe('pin', function () { return pin.ls(`/ipfs/${pins.root}/mercury/`, { type: 'direct' }) .then(out => expect(out).to.have.deep.members([ - { type: 'direct', - hash: pins.mercuryDir } + { + type: 'direct', + hash: pins.mercuryDir + } ]) ) }) @@ -326,8 +348,10 @@ describe('pin', function () { return pin.ls(pins.root, { type: 'recursive' }) .then(out => expect(out).to.have.deep.members([ - { type: 'recursive', - hash: pins.root } + { + type: 'recursive', + hash: pins.root + } ]) ) }) @@ -344,8 +368,10 @@ describe('pin', function () { return pin.ls(pins.solarWiki, { type: 'indirect' }) .then(out => expect(out).to.have.deep.members([ - { type: `indirect through ${pins.root}`, - hash: pins.solarWiki } + { + type: `indirect through ${pins.root}`, + hash: pins.solarWiki + } ]) ) }) diff --git a/test/core/utils.js b/test/core/utils.js index 4da679f18a..bf9bb4060a 100644 --- a/test/core/utils.js +++ b/test/core/utils.js @@ -180,10 +180,10 @@ describe('utils', () => { }) }) - it(`should error when a link doesn't exist`, function (done) { + it('should error when a link doesn\'t exist', function (done) { utils.resolvePath(node.object, `${aboutPath}/fusion`, err => { expect(err.message).to.include( - `no link named "fusion" under QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q` + 'no link named "fusion" under QmbJCNKXJqVK8CzbjpNFz2YekHwh3CSHpBA86uqYg3sJ8q' ) done() }) diff --git a/test/gateway/index.js b/test/gateway/index.js index 2112d5df66..48ecd7dcff 100644 --- a/test/gateway/index.js +++ b/test/gateway/index.js @@ -234,7 +234,7 @@ describe('HTTP Gateway', function () { }) expect(resFirst.statusCode).to.equal(200) expect(resFirst.headers['etag']).to.equal(`"${cid}"`) - expect(resFirst.headers['content-disposition']).to.equal(`inline; filename*=UTF-8''pretty-name-in-utf8-%C3%B3%C3%B0%C5%9B%C3%B3%C3%B0%C5%82%C4%85%C5%9B%C5%81.txt`) + expect(resFirst.headers['content-disposition']).to.equal('inline; filename*=UTF-8\'\'pretty-name-in-utf8-%C3%B3%C3%B0%C5%9B%C3%B3%C3%B0%C5%82%C4%85%C5%9B%C5%81.txt') }) it('load a big file (15MB)', async () => { diff --git a/test/http-api/files.js b/test/http-api/files.js index d1f00e1cd1..0fc29fa5ee 100644 --- a/test/http-api/files.js +++ b/test/http-api/files.js @@ -98,7 +98,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.cp(`/${source}`, `/${destination}`)) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -122,7 +122,7 @@ describe('.files', () => { return ipfs.files.mkdir(`/${source}`) .then(() => ipfs.files.cp(`/${source}`, `/${destination}`)) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -148,7 +148,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.cp([`/${source}`, `/${destination}`])) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -172,7 +172,7 @@ describe('.files', () => { return ipfs.files.mkdir(`/${source}`) .then(() => ipfs.files.cp([`/${source}`, `/${destination}`])) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -196,7 +196,7 @@ describe('.files', () => { const directory = `directory-${hat()}` return ipfs.files.mkdir(`/${directory}`) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -218,7 +218,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.mv(`/${source}`, `/${destination}`)) - .then(() => ipfs.files.ls(`/`)) + .then(() => ipfs.files.ls('/')) .then(files => { const sourceFile = files .filter(file => file.name === source) @@ -240,7 +240,7 @@ describe('.files', () => { return ipfs.files.mkdir(`/${source}`) .then(() => ipfs.files.mv(`/${source}`, `/${destination}`)) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -266,7 +266,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.mv([`/${source}`, `/${destination}`])) - .then(() => ipfs.files.ls(`/`)) + .then(() => ipfs.files.ls('/')) .then(files => { const sourceFile = files .filter(file => file.name === source) @@ -288,7 +288,7 @@ describe('.files', () => { return ipfs.files.mkdir(`/${source}`) .then(() => ipfs.files.mv([`/${source}`, `/${destination}`])) - .then(() => ipfs.files.ls(`/`, { + .then(() => ipfs.files.ls('/', { long: true })) .then(files => { @@ -330,7 +330,7 @@ describe('.files', () => { create: true }) .then(() => ipfs.files.rm(`/${fileName}`)) - .then(() => ipfs.files.ls(`/`)) + .then(() => ipfs.files.ls('/')) .then(files => { const file = files .filter(file => file.name === fileName) @@ -351,7 +351,7 @@ describe('.files', () => { .then(() => ipfs.files.rm(`/${dirName}`, { recursive: true })) - .then(() => ipfs.files.ls(`/`)) + .then(() => ipfs.files.ls('/')) .then(files => { const dir = files .filter(file => file.name === dirName) diff --git a/test/http-api/inject/bootstrap.js b/test/http-api/inject/bootstrap.js index 5c791f2861..713c6be08c 100644 --- a/test/http-api/inject/bootstrap.js +++ b/test/http-api/inject/bootstrap.js @@ -55,7 +55,7 @@ module.exports = (http) => { it('/add/default', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/bootstrap/add/default` + url: '/api/v0/bootstrap/add/default' }) expect(res.statusCode).to.be.eql(200) @@ -79,7 +79,7 @@ module.exports = (http) => { it('/rm/all', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/bootstrap/rm/all` + url: '/api/v0/bootstrap/rm/all' }) expect(res.statusCode).to.be.eql(200) diff --git a/test/http-api/inject/dht.js b/test/http-api/inject/dht.js index 36ca747da4..f844658417 100644 --- a/test/http-api/inject/dht.js +++ b/test/http-api/inject/dht.js @@ -20,7 +20,7 @@ module.exports = (http) => { it('returns 400 if no peerId is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/findpeer` + url: '/api/v0/dht/findpeer' }) expect(res.statusCode).to.equal(400) @@ -42,7 +42,7 @@ module.exports = (http) => { it('returns 400 if no key is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/findprovs` + url: '/api/v0/dht/findprovs' }) expect(res.statusCode).to.equal(400) @@ -65,7 +65,7 @@ module.exports = (http) => { it('returns 400 if no key is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/get` + url: '/api/v0/dht/get' }) expect(res.statusCode).to.equal(400) @@ -98,7 +98,7 @@ module.exports = (http) => { it('returns 400 if no key is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/provide` + url: '/api/v0/dht/provide' }) expect(res.statusCode).to.equal(400) @@ -120,7 +120,7 @@ module.exports = (http) => { it('returns 400 if no key or value is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/dht/put` + url: '/api/v0/dht/put' }) expect(res.statusCode).to.equal(400) diff --git a/test/http-api/inject/name.js b/test/http-api/inject/name.js index 1e723c3749..b181f2935a 100644 --- a/test/http-api/inject/name.js +++ b/test/http-api/inject/name.js @@ -44,7 +44,7 @@ module.exports = (http) => { res = await api.inject({ method: 'GET', - url: `/api/v0/name/resolve` + url: '/api/v0/name/resolve' }) expect(res).to.exist() diff --git a/test/http-api/inject/pin.js b/test/http-api/inject/pin.js index 1442639e2d..50fafe1da2 100644 --- a/test/http-api/inject/pin.js +++ b/test/http-api/inject/pin.js @@ -44,7 +44,7 @@ module.exports = (http) => { it('fails on invalid args', async () => { const res = await api.inject({ method: 'POST', - url: `/api/v0/pin/rm?arg=invalid` + url: '/api/v0/pin/rm?arg=invalid' }) expect(res.statusCode).to.equal(400) @@ -135,7 +135,7 @@ module.exports = (http) => { it('fails on invalid args', async () => { const res = await api.inject({ method: 'POST', - url: `/api/v0/pin/add?arg=invalid` + url: '/api/v0/pin/add?arg=invalid' }) expect(res.statusCode).to.equal(400) @@ -220,7 +220,7 @@ module.exports = (http) => { it('fails on invalid args', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/pin/ls?arg=invalid` + url: '/api/v0/pin/ls?arg=invalid' }) expect(res.statusCode).to.equal(400) @@ -251,7 +251,7 @@ module.exports = (http) => { it('finds pins of type', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/pin/ls?type=recursive` + url: '/api/v0/pin/ls?type=recursive' }) expect(res.statusCode).to.equal(200) @@ -275,7 +275,7 @@ module.exports = (http) => { res = await api.inject({ method: 'POST', - url: `/api/v0/pin/ls?cid-base=base64` + url: '/api/v0/pin/ls?cid-base=base64' }) expect(res.statusCode).to.equal(200) @@ -300,7 +300,7 @@ module.exports = (http) => { res = await api.inject({ method: 'POST', - url: `/api/v0/pin/ls?cid-base=invalid` + url: '/api/v0/pin/ls?cid-base=invalid' }) expect(res.statusCode).to.equal(400) diff --git a/test/http-api/inject/ping.js b/test/http-api/inject/ping.js index ef8cd3bee4..4467a05d11 100644 --- a/test/http-api/inject/ping.js +++ b/test/http-api/inject/ping.js @@ -19,7 +19,7 @@ module.exports = (http) => { it('returns 400 if both n and count are provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/ping?arg=peerid&n=1&count=1` + url: '/api/v0/ping?arg=peerid&n=1&count=1' }) expect(res.statusCode).to.equal(400) @@ -28,7 +28,7 @@ module.exports = (http) => { it('returns 400 if arg is not provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/ping?count=1` + url: '/api/v0/ping?count=1' }) expect(res.statusCode).to.equal(400) @@ -39,7 +39,7 @@ module.exports = (http) => { const res = await api.inject({ method: 'GET', - url: `/api/v0/ping?arg=peerid` + url: '/api/v0/ping?arg=peerid' }) expect(res.statusCode).to.equal(500) diff --git a/test/http-api/inject/pubsub.js b/test/http-api/inject/pubsub.js index 86cec4f078..ce1d803019 100644 --- a/test/http-api/inject/pubsub.js +++ b/test/http-api/inject/pubsub.js @@ -23,7 +23,7 @@ module.exports = (http) => { it('returns 400 if no topic is provided', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/pubsub/sub` + url: '/api/v0/pubsub/sub' }) expect(res.statusCode).to.equal(400) @@ -60,7 +60,7 @@ module.exports = (http) => { it('returns 400 if no buffer is provided', async () => { const res = await api.inject({ method: 'POST', - url: `/api/v0/pubsub/pub?arg=&arg=` + url: '/api/v0/pubsub/pub?arg=&arg=' }) expect(res.statusCode).to.equal(400) @@ -81,7 +81,7 @@ module.exports = (http) => { it('returns 200', async () => { const res = await api.inject({ method: 'GET', - url: `/api/v0/pubsub/ls` + url: '/api/v0/pubsub/ls' }) expect(res.statusCode).to.equal(200) expect(res.result.Strings).to.be.eql([topic])