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

Commit a56508d

Browse files
committed
Add tests for cli#daemon cmd
1 parent 5365f46 commit a56508d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/cli/test-daemon.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* eslint-env mocha */
2+
'use strict'
3+
4+
const expect = require('chai').expect
5+
const clean = require('../utils/clean')
6+
const ipfsCmd = require('../utils/ipfs-exec')
7+
8+
describe('daemon', function () {
9+
this.timeout(1000)
10+
let repoPath
11+
let ipfs
12+
13+
beforeEach(() => {
14+
repoPath = '/tmp/ipfs-test-' + Math.random().toString().substring(2, 8)
15+
ipfs = ipfsCmd(repoPath)
16+
})
17+
18+
afterEach(() => {
19+
clean(repoPath)
20+
})
21+
22+
it('gives error if user hasn\'t run init before', (done) => {
23+
const expectedError = 'no ipfs repo found in ' + repoPath
24+
ipfs('daemon').catch((err) => {
25+
expect(err.stdout).to.have.string(expectedError)
26+
done()
27+
})
28+
})
29+
})

0 commit comments

Comments
 (0)