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 245a63fc44..ab282dfee1 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 66072c5f92..2f7b1f5e33 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 cc6a250c26..e4a7eb1aa1 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 8d05897a6a..0780c23b96 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 37433836ff..cd58002ada 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 73efbb2de2..e427162146 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 4747df2743..c867717b92 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 44730c5cc5..f97707e13c 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 d1c2e09005..203fd6eb5a 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 05a29ffab0..304875bc79 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 b332b91bac..2e4e157142 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 f58ca4de71..8cb56be5f8 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 d1a17d1470..bdc0fc8a33 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 6c14cac94f..3ad3264809 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 73ff556e2b..a9dbc0274a 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 3ec634aeac..27d377904c 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 da141702cd..46c58c8904 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 c6306f5af4..84b5a42c3a 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 a9b2fcf2e6..1b0858786c 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 66b76b2707..0b7084d0a1 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 b066b62789..fbecfe637a 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', () => {