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

Commit 9b345ec

Browse files
committed
feat: modularised types and util
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
1 parent 329deea commit 9b345ec

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

js/src/types.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ const multiaddr = require('multiaddr')
99
const multibase = require('multibase')
1010
const multihash = require('multihashes')
1111
const CID = require('cids')
12-
1312
const chai = require('chai')
1413
const dirtyChai = require('dirty-chai')
14+
const { getDescribe, getIt } = require('./utils/mocha')
15+
1516
const expect = chai.expect
1617
chai.use(dirtyChai)
1718

18-
module.exports = (common) => {
19+
module.exports = (createCommon, options) => {
20+
const describe = getDescribe(options)
21+
const it = getIt(options)
22+
const common = createCommon()
23+
1924
describe('.types', function () {
2025
let ipfs
2126

@@ -34,11 +39,9 @@ module.exports = (common) => {
3439
})
3540
})
3641

37-
after((done) => {
38-
common.teardown(done)
39-
})
42+
after((done) => common.teardown(done))
4043

41-
it('types object', () => {
44+
it('should have a types object with the required values', () => {
4245
expect(ipfs.types).to.be.deep.equal({
4346
Buffer: Buffer,
4447
PeerId: PeerId,

js/src/util.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ const crypto = require('libp2p-crypto')
55
const isIPFS = require('is-ipfs')
66
const chai = require('chai')
77
const dirtyChai = require('dirty-chai')
8+
const { getDescribe, getIt } = require('./utils/mocha')
9+
810
const expect = chai.expect
911
chai.use(dirtyChai)
1012

11-
module.exports = (common) => {
13+
module.exports = (createCommon, options) => {
14+
const describe = getDescribe(options)
15+
const it = getIt(options)
16+
const common = createCommon()
17+
1218
describe('.util', function () {
1319
let ipfs
1420

@@ -27,11 +33,9 @@ module.exports = (common) => {
2733
})
2834
})
2935

30-
after((done) => {
31-
common.teardown(done)
32-
})
36+
after((done) => common.teardown(done))
3337

34-
it('util object', () => {
38+
it('should have a util object with the required values', () => {
3539
expect(ipfs.util).to.be.deep.equal({
3640
crypto: crypto,
3741
isIPFS: isIPFS

0 commit comments

Comments
 (0)