Skip to content

Commit

Permalink
Refactored tests for config/configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
SwinX committed Sep 14, 2015
1 parent d0919bc commit 5833c69
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions test/lib/config/configurable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@ describe('config/configurable', function () {
configurable = new Configurable();
});

describe('constructor', function () {
it('should create empty container for chains', function () {
expect(configurable._chains).to.be.instanceOf(Array)
.and.to.be.empty;
});
});

describe('addChain', function () {
it('should add calback to call chain', function () {
var testFunc = function () {};
var testFunc = sinon.stub();

configurable.addChain(testFunc);

expect(configurable._chains).to.contain(testFunc);
return configurable.exec().then(function () {
expect(testFunc).to.be.called;
});
});

it('should support method chaining pattern', function () {
Expand All @@ -32,12 +27,14 @@ describe('config/configurable', function () {
});

describe('configure', function () {
it('should add calback to call chain', function () {
var testFunc = function () {};
it('should add callback to call chain', function () {
var testFunc = sinon.stub();

configurable.configure(testFunc);

expect(configurable._chains).to.contain(testFunc);
return configurable.exec().then(function () {
expect(testFunc).to.be.called;
});
});

it('should support method chaining pattern', function () {
Expand Down

0 comments on commit 5833c69

Please sign in to comment.