Skip to content

Commit 930e6db

Browse files
committed
fix: tests setup
1 parent 1ba2851 commit 930e6db

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"err-code": "^1.1.2",
6666
"interface-datastore": "~0.7.0",
6767
"ipfs-block": "~0.8.1",
68-
"ipfs-repo-migrations": "ipfs/js-ipfs-repo-migrations#dev",
68+
"ipfs-repo-migrations": "ipfs/js-ipfs-repo-migrations#master",
6969
"just-safe-get": "^1.3.0",
7070
"just-safe-set": "^2.1.0",
7171
"lodash.has": "^4.5.2",

test/migrations-test.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const IPFSRepo = require('../src')
1515

1616
module.exports = (createTempRepo) => {
1717
describe('Migrations tests', () => {
18-
let teardown
1918
let repo
2019
let migrateStub
2120
let repoVersionStub
@@ -34,14 +33,10 @@ module.exports = (createTempRepo) => {
3433
})
3534

3635
beforeEach(async () => {
37-
({ instance: repo, teardown } = await createTempRepo({}))
36+
({ instance: repo } = await createTempRepo({}))
3837
sinon.reset()
3938
})
4039

41-
afterEach(async () => {
42-
await teardown()
43-
})
44-
4540
it('should migrate by default', async () => {
4641
migrateStub.resolves()
4742
repoVersionStub.value(8)

test/node.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const rimraf = require('rimraf')
66
const fs = require('fs')
77
const path = require('path')
88
const promisify = require('util').promisify
9+
const os = require('os')
910

1011
const chai = require('chai')
1112
chai.use(require('dirty-chai'))
@@ -19,7 +20,7 @@ const IPFSRepo = require('../src')
1920
async function createTempRepo ({ init, dontOpen, opts }) {
2021
const testRepoPath = path.join(__dirname, 'test-repo')
2122
const date = Date.now().toString()
22-
const repoPath = testRepoPath + '-for-' + date
23+
const repoPath = path.join(os.tmpdir(), 'test-repo-for-' + date)
2324

2425
const repo = new IPFSRepo(repoPath, opts)
2526

@@ -36,13 +37,6 @@ async function createTempRepo ({ init, dontOpen, opts }) {
3637
return {
3738
path: repoPath,
3839
instance: repo,
39-
teardown: async () => {
40-
try {
41-
await repo.close()
42-
} catch (e) {
43-
}
44-
await asyncRimraf(repoPath)
45-
}
4640
}
4741
}
4842

0 commit comments

Comments
 (0)