Skip to content

Commit 0035679

Browse files
committed
Added pending tests for parser and plugin absolute files.
Added additional check to tests.
1 parent 1858b8f commit 0035679

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

test/specs/loaders.js

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const assert = require('assert');
2+
const {resolve} = require('path');
23

34
const loaders = require('../../lib/loaders');
45

@@ -33,10 +34,20 @@ describe('loaders', () => {
3334

3435
describe('loadParser', () => {
3536

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')));
3743

3844
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')));
4051

4152
it('fails on invalid parser', () =>
4253
loaders.loadParser({'parser': 'invalid'}).catch(err => {
@@ -64,13 +75,31 @@ describe('loaders', () => {
6475

6576
describe('loadPlugin', () => {
6677

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')));
6887

6988
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')));
7195

7296
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')));
74103

75104
it('fails on invalid plugin', () =>
76105
loaders.loadPlugin({'layout': 'invalid'}).catch(err => {

0 commit comments

Comments
 (0)