summaryrefslogtreecommitdiffstats
path: root/test/1-config.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/1-config.js')
-rw-r--r--test/1-config.js50
1 files changed, 34 insertions, 16 deletions
diff --git a/test/1-config.js b/test/1-config.js
index 474ffea..3ec76ca 100644
--- a/test/1-config.js
+++ b/test/1-config.js
@@ -2,38 +2,56 @@ var mock = require('./mock');
describe('Config', function() {
- describe('config.load()', function() {
- it('should not fail if no configuration file', function() {
+ describe('No configuration', function() {
+ var book;
+
+ before(function() {
return mock.setupDefaultBook()
- .then(function(book) {
+ .then(function(_book) {
+ book = _book;
return book.prepareConfig();
});
});
- it('should load from a JSON file', function() {
+ it('should signal that configuration is not defined', function() {
+ book.config.exists().should.not.be.ok();
+ });
+ });
+
+ describe('JSON file', function() {
+ var book;
+
+ before(function() {
return mock.setupDefaultBook({
'book.json': { title: 'Hello World' }
})
- .then(function(book) {
- return book.prepareConfig()
- .then(function() {
- book.config.get('title', '').should.equal('Hello World');
- });
+ .then(function(_book) {
+ book = _book;
+ return book.prepareConfig();
});
});
- it('should load from a JS file', function() {
+ it('should correctly extend configuration', function() {
+ book.config.get('title', '').should.equal('Hello World');
+ });
+ });
+
+ describe('JS file', function() {
+ var book;
+
+ before(function() {
return mock.setupDefaultBook({
'book.js': 'module.exports = { title: "Hello World" };'
})
- .then(function(book) {
- return book.prepareConfig()
- .then(function() {
- book.config.get('title', '').should.equal('Hello World');
- });
+ .then(function(_book) {
+ book = _book;
+ return book.prepareConfig();
});
});
- });
+ it('should correctly extend configuration', function() {
+ book.config.get('title', '').should.equal('Hello World');
+ });
+ });
});