|
1 | 1 | const assert = require('assert');
|
| 2 | +const {resolve} = require('path'); |
2 | 3 |
|
3 | 4 | const loaders = require('../../lib/loaders');
|
4 | 5 |
|
@@ -33,10 +34,20 @@ describe('loaders', () => {
|
33 | 34 |
|
34 | 35 | describe('loadParser', () => {
|
35 | 36 |
|
36 |
| - it('loads dox parser', () => loaders.loadParser({'parser': 'dox'})); |
| 37 | + const PARSER_PATH = './test/fixtures/parser.js'; |
| 38 | + const PARSER_PATH_ABSOLUTE = resolve(PARSER_PATH); |
| 39 | + |
| 40 | + it('loads dox parser', () => |
| 41 | + loaders.loadParser({'parser': 'dox'}) |
| 42 | + .then(parser => assert.equal(typeof parser, 'function'))); |
37 | 43 |
|
38 | 44 | it('loads custom parser when file is specified', () =>
|
39 |
| - loaders.loadParser({'parser': './test/fixtures/parser.js'})); |
| 45 | + loaders.loadParser({'parser': PARSER_PATH}) |
| 46 | + .then(parser => assert.equal(typeof parser, 'function'))); |
| 47 | + |
| 48 | + it.skip('loads custom parser when file (absolute path) is specified', () => |
| 49 | + loaders.loadParser({'parser': PARSER_PATH_ABSOLUTE}) |
| 50 | + .then(parser => assert.equal(typeof parser, 'function'))); |
40 | 51 |
|
41 | 52 | it('fails on invalid parser', () =>
|
42 | 53 | loaders.loadParser({'parser': 'invalid'}).catch(err => {
|
@@ -64,13 +75,31 @@ describe('loaders', () => {
|
64 | 75 |
|
65 | 76 | describe('loadPlugin', () => {
|
66 | 77 |
|
67 |
| - it('loads markdown plugin', () => loaders.loadPlugin({'layout': 'markdown'})); |
| 78 | + const TEMPLATE_PATH = './test/fixtures/template.hbs'; |
| 79 | + const TEMPLATE_PATH_ABSOLUTE = resolve(TEMPLATE_PATH); |
| 80 | + |
| 81 | + const PLUGIN_PATH = './test/fixtures/plugin.js'; |
| 82 | + const PLUGIN_PATH_ABSOLUTE = resolve(PLUGIN_PATH); |
| 83 | + |
| 84 | + it('loads markdown plugin', () => |
| 85 | + loaders.loadPlugin({'layout': 'markdown'}) |
| 86 | + .then(plugin => assert.equal(typeof plugin, 'function'))); |
68 | 87 |
|
69 | 88 | it('loads custom handlebars plugin when file is specified', () =>
|
70 |
| - loaders.loadPlugin({'layout': './test/fixtures/template.hbs'})); |
| 89 | + loaders.loadPlugin({'layout': TEMPLATE_PATH}) |
| 90 | + .then(plugin => assert.equal(typeof plugin, 'function'))); |
| 91 | + |
| 92 | + it.skip('loads custom handlebars plugin when file (absolute path) is specified', () => |
| 93 | + loaders.loadPlugin({'layout': TEMPLATE_PATH_ABSOLUTE}) |
| 94 | + .then(plugin => assert.equal(typeof plugin, 'function'))); |
71 | 95 |
|
72 | 96 | it('load custom plugin via JavaScript file', () =>
|
73 |
| - loaders.loadPlugin({'layout': './test/fixtures/plugin.js'})); |
| 97 | + loaders.loadPlugin({'layout': PLUGIN_PATH}) |
| 98 | + .then(plugin => assert.equal(typeof plugin, 'function'))); |
| 99 | + |
| 100 | + it.skip('load custom plugin via JavaScript file (absolute path)', () => |
| 101 | + loaders.loadPlugin({'layout': PLUGIN_PATH_ABSOLUTE}) |
| 102 | + .then(plugin => assert.equal(typeof plugin, 'function'))); |
74 | 103 |
|
75 | 104 | it('fails on invalid plugin', () =>
|
76 | 105 | loaders.loadPlugin({'layout': 'invalid'}).catch(err => {
|
|
0 commit comments