summaryrefslogtreecommitdiffstats
path: root/test/config.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/config.js')
-rw-r--r--test/config.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/config.js b/test/config.js
new file mode 100644
index 0000000..3ec76ca
--- /dev/null
+++ b/test/config.js
@@ -0,0 +1,57 @@
+var mock = require('./mock');
+
+describe('Config', function() {
+
+ describe('No configuration', function() {
+ var book;
+
+ before(function() {
+ return mock.setupDefaultBook()
+ .then(function(_book) {
+ book = _book;
+ return book.prepareConfig();
+ });
+ });
+
+ 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) {
+ book = _book;
+ return book.prepareConfig();
+ });
+ });
+
+ 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) {
+ book = _book;
+ return book.prepareConfig();
+ });
+ });
+
+ it('should correctly extend configuration', function() {
+ book.config.get('title', '').should.equal('Hello World');
+ });
+ });
+});
+