diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-24 23:14:17 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-03-24 23:14:17 +0100 |
commit | c9af209a9335ea1219c3149eb12c2daa271c9403 (patch) | |
tree | 72df3edf7a67db465ce2dacbbf204974253b818a /test/configuration.js | |
parent | 63ee94ff89d10e56d82079183c494f8129b92eae (diff) | |
parent | 48ab44a776b665b1d3627192cf82e9220ec74678 (diff) | |
download | gitbook-c9af209a9335ea1219c3149eb12c2daa271c9403.zip gitbook-c9af209a9335ea1219c3149eb12c2daa271c9403.tar.gz gitbook-c9af209a9335ea1219c3149eb12c2daa271c9403.tar.bz2 |
Merge pull request #667 from GitbookIO/better-testing
Better Unit Tests
Diffstat (limited to 'test/configuration.js')
-rw-r--r-- | test/configuration.js | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/test/configuration.js b/test/configuration.js index e690f2c..eedec49 100644 --- a/test/configuration.js +++ b/test/configuration.js @@ -1,14 +1,32 @@ +var fs = require('fs'); var path = require('path'); -var assert = require('assert'); -var Book = require('../').Book; +describe('Configuration', function () { + it('should extract default title from README', function() { + return books.parse("basic") + .then(function(book) { + book.options.title.should.be.equal("Readme"); + }); + }); + + it('should extract default description from README', function() { + return books.parse("basic") + .then(function(book) { + book.options.description.should.be.equal("Default description for the book."); + }); + }); -describe('Configuration parsing', function () { - it('should correctly load from json', function() { - assert(books[0].options.title == "Test"); + it('should correctly load from json (book.json)', function() { + return books.parse("config-json") + .then(function(book) { + book.options.title.should.be.equal("json-config"); + }); }); - it('should correctly load from javascript', function() { - assert(books[4].options.title == "Test 2"); + it('should correctly load from JavaScript (book.js)', function() { + return books.parse("config-js") + .then(function(book) { + book.options.title.should.be.equal("js-config"); + }); }); }); |