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

Commit b7a0125

Browse files
committed
fix mkdirp issue
1 parent be7a0d1 commit b7a0125

File tree

3 files changed

+224
-239
lines changed

3 files changed

+224
-239
lines changed

test/node.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const rimraf = require('rimraf')
77
const expect = require('chai').expect
88
const path = require('path')
99
const IPFSRepo = require('ipfs-repo')
10+
const fsbs = require('fs-blob-store')
1011

1112
describe('core', () => {
1213
const repoExample = path.join(process.cwd(), '/test/repo-example')
@@ -20,16 +21,29 @@ describe('core', () => {
2021
})
2122
})
2223

24+
before((done) => {
25+
fs.stat(path.join(__dirname, '/test-data/dir-nested/dir-another'), (err, exists) => {
26+
if (err) {
27+
fs.mkdirSync(path.join(__dirname, '/test-data/dir-nested/dir-another'))
28+
}
29+
})
30+
31+
fs.stat(path.join(__dirname, '/test-data/dir-nested/level-1/level-2'), (err, exists) => {
32+
if (err) {
33+
fs.mkdirSync(path.join(__dirname, '/test-data/dir-nested/level-1/level-2'))
34+
}
35+
done()
36+
})
37+
})
38+
2339
after((done) => {
2440
rimraf(repoTests, (err) => {
2541
expect(err).to.equal(null)
2642
done()
2743
})
2844
})
2945

30-
const fsb = require ('fs-blob-store')
31-
const repo = new IPFSRepo(repoTests, {stores: fsb})
32-
const tests = fs.readdirSync(__dirname)
46+
const repo = new IPFSRepo(repoTests, {stores: fsbs})
3347
require('./test-exporter')(repo)
3448
require('./test-importer')(repo)
3549
require('./test-fixed-size-chunker')

test/test-exporter.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,14 @@ const exporter = unixFSEngine.exporter
66
const expect = require('chai').expect
77
const BlockService = require('ipfs-blocks').BlockService
88
const DAGService = require('ipfs-merkle-dag').DAGService
9-
const fsBS = require('fs-blob-store')
10-
const fs = require('fs')
119
const UnixFS = require('ipfs-unixfs')
12-
const path = require('path')
13-
const Repo = require('ipfs-repo')
1410

1511
let ds
16-
let r
1712

1813
module.exports = function (repo) {
1914
describe('exporter', function () {
2015
before((done) => {
21-
const options = { stores: fsBS }
22-
r = repo
23-
const bs = new BlockService(r)
16+
const bs = new BlockService(repo)
2417
expect(bs).to.exist
2518
ds = new DAGService(bs)
2619
expect(ds).to.exist

0 commit comments

Comments
 (0)