-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f22db9
commit cc8e825
Showing
2 changed files
with
43 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,54 @@ | ||
var Api = require('../lib/api'); | ||
var sinon = require('sinon'); | ||
var App = require('../lib/app'); | ||
var Config = require('../lib/config'); | ||
var sinon = require('sinon'); | ||
var expect = require('chai').expect; | ||
|
||
var FakeReporter = require('./support/fake_reporter'); | ||
|
||
describe('Api', function() { | ||
var sandbox; | ||
|
||
beforeEach(function() { | ||
sandbox = sinon.sandbox.create(); | ||
sandbox.stub(App.prototype, 'initReporter').returns(new FakeReporter()); | ||
sandbox.stub(Config.prototype, 'read'); | ||
}); | ||
|
||
afterEach(function() { | ||
sandbox.restore(); | ||
}); | ||
|
||
it('set defaults when using dev mode', function() { | ||
var api = new Api(); | ||
api.startDev({parallel: 5, on_exit: 'test'}); | ||
expect(api.config.read.callCount).to.equal(1); | ||
expect(api.config.get('on_exit')).to.equal('test'); | ||
expect(api.config.get('parallel')).to.equal(-1); | ||
expect(api.config.get('reporter')).to.equal('dev'); | ||
describe('new', function() { | ||
it('set defaults when using dev mode', function() { | ||
var api = new Api(); | ||
api.startDev({parallel: 5, on_exit: 'test'}); | ||
expect(api.config.read.callCount).to.equal(1); | ||
expect(api.config.get('on_exit')).to.equal('test'); | ||
expect(api.config.get('parallel')).to.equal(-1); | ||
expect(api.config.get('reporter')).to.equal('dev'); | ||
}); | ||
|
||
it('set defaults when using CI mode', function() { | ||
var api = new Api(); | ||
api.startCI({parallel: 5, on_exit: 'test'}); | ||
expect(api.config.read.callCount).to.equal(1); | ||
expect(api.config.get('on_exit')).to.equal('test'); | ||
expect(api.config.get('parallel')).to.equal(5); | ||
expect(api.config.get('disable_watching')).to.equal(true); | ||
expect(api.config.get('single_run')).to.equal(true); | ||
}); | ||
}); | ||
|
||
it('set defaults when using CI mode', function() { | ||
var api = new Api(); | ||
api.startCI({parallel: 5, on_exit: 'test'}); | ||
expect(api.config.read.callCount).to.equal(1); | ||
expect(api.config.get('on_exit')).to.equal('test'); | ||
expect(api.config.get('parallel')).to.equal(5); | ||
expect(api.config.get('disable_watching')).to.equal(true); | ||
expect(api.config.get('single_run')).to.equal(true); | ||
describe('restart', function() { | ||
it('allows to restart the tests', function(done) { | ||
var api = new Api(); | ||
api.startCI({}, function() {}); | ||
api.app = new App(api.config, done); | ||
sandbox.stub(api.app, 'stopCurrentRun'); | ||
api.restart(); | ||
expect(api.app.stopCurrentRun.callCount).to.equal(1); | ||
api.app.exit(); | ||
}); | ||
}); | ||
}); |