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

Commit

Permalink
Add tests for cli#daemon cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
victorb committed Nov 29, 2016
1 parent 5365f46 commit ed38240
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/cli/test-daemon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const clean = require('../utils/clean')
const ipfsCmd = require('../utils/ipfs-exec')

describe('daemon', function () {
let repoPath
let ipfs

beforeEach(() => {
repoPath = '/tmp/ipfs-test-' + Math.random().toString().substring(2, 8)
ipfs = ipfsCmd(repoPath)
})

afterEach(() => {
clean(repoPath)
})

it('gives error if user hasn\'t run init before', (done) => {
const expectedError = 'no ipfs repo found in ' + repoPath
ipfs('daemon').catch((err) => {
expect(err.stdout).to.have.string(expectedError)
done()
})
})
})

0 comments on commit ed38240

Please sign in to comment.