mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-12 07:58:49 +00:00
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
var mock = require('./mock');
|
|
|
|
describe('Config', function() {
|
|
|
|
describe('config.load()', function() {
|
|
it('should not fail if no configuration file', function() {
|
|
return mock.setupDefaultBook()
|
|
.then(function(book) {
|
|
return book.prepareConfig();
|
|
});
|
|
});
|
|
|
|
it('should load from a JSON file', 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');
|
|
});
|
|
});
|
|
});
|
|
|
|
it('should load from a JS file', 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');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
});
|
|
|