Commit be096919 authored by Björn Bartels's avatar Björn Bartels

PATLAB-7 update config tests

parent 77e039c8
Pipeline #74 passed with stage
in 4 minutes and 5 seconds
......@@ -179,32 +179,5 @@ module.exports = function(opts) {
checkStaticPages(this);
// initialises doc page as body-partial and compiled template
/*if (this.options.gui.layout) {
if (this.options.gui.docpage) {
try {
var pagefile = path.join(this.options.root, this.options.basepath, this.options.pattern.docpage);
var pageSource = fs.readFileSync(pagefile);
var page = fm(pageSource.toString());
if (page.attributes.layout != '') {
this.layout = page.attributes.layout;
}
} catch (e) {
throw new Error('Error loading Patternlibrary doc page template file: ' + e.message);
}
// Now create Handlebars templates out of them
this.template = this.handlebars.compile(page.body, {noEscape: true});
// Finally, add the page as a partial called "body", and render the layout template
this.handlebars.registerPartial('body', this.template);
} else {
throw new Error('No path to a doc page template was set in Patternlibrary.config().');
}
} else {
throw new Error('No path to a layout was set in Patternlibrary.config().');
}*/
return this;
}
......@@ -3,10 +3,11 @@ import Patternlibrary from '..';
var extend = require('deep-extend');
var expect = require('chai').expect;
var defaults = require('../lib/config/defaults');
describe('Patternlibrary instanciation and configuration:', function() {
describe('Patternlibrary.config()', function() {
var defaults = require('../lib/config/defaults');
it('merges default and user configuration objects', function() {
var p = new Patternlibrary.Patternlibrary();
......@@ -86,7 +87,9 @@ describe('Patternlibrary instanciation and configuration:', function() {
cfg.categoriespath = '';
expect(function() { p.config(cfg); }).to.throw(Error);
});
});
describe('Patternlibrary.config() - patterns\' options checks', function() {
it('throws error if the pattern\'s "pattern" option is missing or empty', function() {
var p = new Patternlibrary.Patternlibrary();
var cfg = extend({}, defaults);
......@@ -202,9 +205,19 @@ describe('Patternlibrary instanciation and configuration:', function() {
expect(function() { p.config(cfg); }).to.throw(Error);
});
});
describe('Patternlibrary.config() - adapter patterns\' options checks', function() {
});
describe('Patternlibrary.config() - GUI paths\' options checks', function() {
});
describe('Patternlibrary.config() - static pages paths\' options checks', function() {
});
describe('Patternlibrary.init()', function() {
it('should contain no \'handlebars\' instance before first execution', function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment