From 93765c155275d2218c43d6d11082579e8782c3d4 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 3 Oct 2019 12:13:30 +0100 Subject: [PATCH] fix: pull in preconfigured chai from interface tests --- package.json | 3 --- test/commands.spec.js | 7 +------ test/constructor.spec.js | 6 +----- test/custom-headers.spec.js | 6 +----- test/dag.spec.js | 7 +------ test/diag.spec.js | 6 +----- test/endpoint-config.spec.js | 6 +----- test/exports.spec.js | 5 +---- test/files-mfs.spec.js | 7 +------ test/get.spec.js | 7 +------ test/key.spec.js | 6 +----- test/lib.configure.spec.js | 6 +----- test/lib.error-handler.spec.js | 5 +---- test/lib.stream-to-iterable.spec.js | 5 +---- test/log.spec.js | 6 +----- test/node/swarm.js | 8 +------- test/ping.spec.js | 7 +------ test/repo.spec.js | 6 +----- test/request-api.spec.js | 5 +---- test/stats.spec.js | 6 +----- test/sub-modules.spec.js | 10 ++++------ 21 files changed, 23 insertions(+), 107 deletions(-) diff --git a/package.json b/package.json index 245a63fc4..ab282dfee 100644 --- a/package.json +++ b/package.json @@ -105,10 +105,7 @@ "devDependencies": { "aegir": "^20.3.1", "browser-process-platform": "~0.1.1", - "chai": "^4.2.0", - "chai-as-promised": "^7.1.1", "cross-env": "^6.0.0", - "dirty-chai": "^2.0.1", "go-ipfs-dep": "^0.4.22", "interface-ipfs-core": "ipfs/interface-js-ipfs-core#add-listing-config-profiles", "ipfsd-ctl": "^0.47.1", diff --git a/test/commands.spec.js b/test/commands.spec.js index 66072c5f9..2f7b1f5e3 100644 --- a/test/commands.spec.js +++ b/test/commands.spec.js @@ -1,13 +1,8 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) - +const { expect } = require('interface-ipfs-core/src/utils/mocha') const ipfsClient = require('../src') - const f = require('./utils/factory') describe('.commands', function () { diff --git a/test/constructor.spec.js b/test/constructor.spec.js index cc6a250c2..e4a7eb1aa 100644 --- a/test/constructor.spec.js +++ b/test/constructor.spec.js @@ -2,11 +2,7 @@ 'use strict' const multiaddr = require('multiaddr') -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) - +const { expect } = require('interface-ipfs-core/src/utils/mocha') const f = require('./utils/factory') const ipfsClient = require('../src/index.js') diff --git a/test/custom-headers.spec.js b/test/custom-headers.spec.js index 8d05897a6..0780c23b9 100644 --- a/test/custom-headers.spec.js +++ b/test/custom-headers.spec.js @@ -2,11 +2,7 @@ 'use strict' const isNode = require('detect-node') -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) - +const { expect } = require('interface-ipfs-core/src/utils/mocha') const ipfsClient = require('../src') const f = require('./utils/factory') diff --git a/test/dag.spec.js b/test/dag.spec.js index 37433836f..cd58002ad 100644 --- a/test/dag.spec.js +++ b/test/dag.spec.js @@ -3,12 +3,7 @@ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const chaiAsPromised = require('chai-as-promised') -const expect = chai.expect -chai.use(dirtyChai) -chai.use(chaiAsPromised) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const { DAGNode } = require('ipld-dag-pb') const CID = require('cids') const ipfsClient = require('../src') diff --git a/test/diag.spec.js b/test/diag.spec.js index 73efbb2de..e42716214 100644 --- a/test/diag.spec.js +++ b/test/diag.spec.js @@ -1,12 +1,8 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const platform = require('browser-process-platform') - const ipfsClient = require('../src') const f = require('./utils/factory') diff --git a/test/endpoint-config.spec.js b/test/endpoint-config.spec.js index 4747df274..c867717b9 100644 --- a/test/endpoint-config.spec.js +++ b/test/endpoint-config.spec.js @@ -2,12 +2,8 @@ /* eslint max-nested-callbacks: ["error", 8] */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const isNode = require('detect-node') - const ipfsClient = require('../src') const f = require('./utils/factory') diff --git a/test/exports.spec.js b/test/exports.spec.js index 44730c5cc..f97707e13 100644 --- a/test/exports.spec.js +++ b/test/exports.spec.js @@ -9,10 +9,7 @@ const multicodec = require('multicodec') const multihash = require('multihashes') const PeerId = require('peer-id') const PeerInfo = require('peer-info') -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const IpfsHttpClient = require('../') diff --git a/test/files-mfs.spec.js b/test/files-mfs.spec.js index d1c2e0900..203fd6eb5 100644 --- a/test/files-mfs.spec.js +++ b/test/files-mfs.spec.js @@ -2,12 +2,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const chaiAsPromised = require('chai-as-promised') -const expect = chai.expect -chai.use(dirtyChai) -chai.use(chaiAsPromised) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const loadFixture = require('aegir/fixtures') const mh = require('multihashes') const CID = require('cids') diff --git a/test/get.spec.js b/test/get.spec.js index 05a29ffab..304875bc7 100644 --- a/test/get.spec.js +++ b/test/get.spec.js @@ -3,12 +3,7 @@ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const chaiAsPromised = require('chai-as-promised') -const expect = chai.expect -chai.use(dirtyChai) -chai.use(chaiAsPromised) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const loadFixture = require('aegir/fixtures') const ipfsClient = require('../src') diff --git a/test/key.spec.js b/test/key.spec.js index b332b91ba..2e4e15714 100644 --- a/test/key.spec.js +++ b/test/key.spec.js @@ -2,11 +2,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) - +const { expect } = require('interface-ipfs-core/src/utils/mocha') const ipfsClient = require('../src') const f = require('./utils/factory') diff --git a/test/lib.configure.spec.js b/test/lib.configure.spec.js index f58ca4de7..8cb56be5f 100644 --- a/test/lib.configure.spec.js +++ b/test/lib.configure.spec.js @@ -1,13 +1,9 @@ /* eslint-env mocha, browser */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const Multiaddr = require('multiaddr') const { isBrowser, isWebWorker } = require('ipfs-utils/src/env') - const configure = require('../src/lib/configure') describe('lib/configure', () => { diff --git a/test/lib.error-handler.spec.js b/test/lib.error-handler.spec.js index d1a17d147..bdc0fc8a3 100644 --- a/test/lib.error-handler.spec.js +++ b/test/lib.error-handler.spec.js @@ -1,11 +1,8 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') +const { expect } = require('interface-ipfs-core/src/utils/mocha') const { HTTPError } = require('ky-universal') -const expect = chai.expect -chai.use(dirtyChai) const throwsAsync = require('./utils/throws-async') const errorHandler = require('../src/lib/error-handler') diff --git a/test/lib.stream-to-iterable.spec.js b/test/lib.stream-to-iterable.spec.js index 6c14cac94..3ad326480 100644 --- a/test/lib.stream-to-iterable.spec.js +++ b/test/lib.stream-to-iterable.spec.js @@ -1,10 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const toIterable = require('../src/lib/stream-to-iterable') describe('lib/stream-to-iterable', () => { diff --git a/test/log.spec.js b/test/log.spec.js index 73ff556e2..a9dbc0274 100644 --- a/test/log.spec.js +++ b/test/log.spec.js @@ -2,11 +2,7 @@ /* eslint max-nested-callbacks: ["error", 8] */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) - +const { expect } = require('interface-ipfs-core/src/utils/mocha') const ipfsClient = require('../src') const f = require('./utils/factory') diff --git a/test/node/swarm.js b/test/node/swarm.js index 3ec634aea..27d377904 100644 --- a/test/node/swarm.js +++ b/test/node/swarm.js @@ -1,14 +1,8 @@ /* eslint-env mocha */ 'use strict' +const { expect } = require('interface-ipfs-core/src/utils/mocha') const nock = require('nock') -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const chaiAsPromised = require('chai-as-promised') -const expect = chai.expect -chai.use(dirtyChai) -chai.use(chaiAsPromised) - const ipfsClient = require('../../src') describe('.swarm.peers', function () { diff --git a/test/ping.spec.js b/test/ping.spec.js index da141702c..46c58c890 100644 --- a/test/ping.spec.js +++ b/test/ping.spec.js @@ -1,12 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const chaiAsPromised = require('chai-as-promised') -const expect = chai.expect -chai.use(dirtyChai) -chai.use(chaiAsPromised) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const pull = require('pull-stream/pull') const collect = require('pull-stream/sinks/collect') diff --git a/test/repo.spec.js b/test/repo.spec.js index c6306f5af..84b5a42c3 100644 --- a/test/repo.spec.js +++ b/test/repo.spec.js @@ -1,11 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) - +const { expect } = require('interface-ipfs-core/src/utils/mocha') const ipfsClient = require('../src') const f = require('./utils/factory') diff --git a/test/request-api.spec.js b/test/request-api.spec.js index a9b2fcf2e..1b0858786 100644 --- a/test/request-api.spec.js +++ b/test/request-api.spec.js @@ -1,10 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('interface-ipfs-core/src/utils/mocha') const isNode = require('detect-node') const ipfsClient = require('../src/index.js') const ndjson = require('ndjson') diff --git a/test/stats.spec.js b/test/stats.spec.js index 66b76b270..0b7084d0a 100644 --- a/test/stats.spec.js +++ b/test/stats.spec.js @@ -1,11 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) - +const { expect } = require('interface-ipfs-core/src/utils/mocha') const ipfsClient = require('../src') const f = require('./utils/factory') diff --git a/test/sub-modules.spec.js b/test/sub-modules.spec.js index b066b6278..fbecfe637 100644 --- a/test/sub-modules.spec.js +++ b/test/sub-modules.spec.js @@ -1,11 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) - +const { expect } = require('interface-ipfs-core/src/utils/mocha') const defaultConfig = require('../src/utils/default-config.js') const config = defaultConfig() config.host = 'test' @@ -42,7 +38,9 @@ describe('submodules', () => { expect(cfg.get).to.be.a('function') expect(cfg.set).to.be.a('function') expect(cfg.replace).to.be.a('function') - expect(cfg.profile).to.be.a('function') + expect(cfg).to.have.a.property('profiles') + expect(cfg.profiles.list).to.be.a('function') + expect(cfg.profiles.apply).to.be.a('function') }) it('dht', () => {