|
1 | 1 | /* eslint-disable no-console */ |
2 | | - |
| 2 | +const { normalize } = require('path'); |
3 | 3 | const getTemplatePath = require('../../lib/core/getTemplatePath'); |
4 | 4 |
|
5 | 5 | describe('guessTemplatePath', () => { |
6 | 6 | test('guess default', () => { |
7 | | - expect(getTemplatePath().endsWith('lib/templates/default.ejs')).toBeTruthy(); |
8 | | - expect(getTemplatePath('default').endsWith('lib/templates/default.ejs')).toBeTruthy(); |
| 7 | + expect(getTemplatePath().endsWith(normalize('lib/templates/default.ejs'))).toBeTruthy(); |
| 8 | + expect(getTemplatePath('default').endsWith(normalize('lib/templates/default.ejs'))).toBeTruthy(); |
9 | 9 | }); |
10 | 10 |
|
11 | 11 | test('guess docstrap', () => { |
12 | 12 | const templatePath = getTemplatePath('./node_modules/ink-docstrap/template'); |
13 | 13 |
|
14 | | - expect(templatePath.endsWith('lib/templates/docstrap.ejs')).toBeTruthy(); |
| 14 | + expect(templatePath.endsWith(normalize('lib/templates/docstrap.ejs'))).toBeTruthy(); |
15 | 15 | }); |
16 | 16 |
|
17 | 17 | test('guess minami', () => { |
18 | 18 | const templatePath = getTemplatePath('node_modules/minami'); |
19 | 19 |
|
20 | | - expect(templatePath.endsWith('lib/templates/minami.ejs')).toBeTruthy(); |
| 20 | + expect(templatePath.endsWith(normalize('lib/templates/minami.ejs'))).toBeTruthy(); |
21 | 21 | }); |
22 | 22 |
|
23 | 23 | test('guess tui', () => { |
24 | 24 | const templatePath = getTemplatePath('node_modules/tui-jsdoc-template'); |
25 | 25 |
|
26 | | - expect(templatePath.endsWith('lib/templates/tui.ejs')).toBeTruthy(); |
| 26 | + expect(templatePath.endsWith(normalize('lib/templates/tui.ejs'))).toBeTruthy(); |
27 | 27 | }); |
28 | 28 |
|
29 | 29 | test('guess unsupported', () => { |
30 | 30 | console.warn = jest.fn(); |
31 | 31 |
|
32 | | - expect(getTemplatePath('foo-bar').endsWith('lib/templates/default.ejs')).toBeTruthy(); |
| 32 | + expect(getTemplatePath('foo-bar').endsWith(normalize('lib/templates/default.ejs'))).toBeTruthy(); |
33 | 33 | expect(console.warn).toHaveBeenCalledWith('The template "foo-bar" is not recognized by jsdoc-vuejs. Using default template as fallback.'); |
34 | 34 | }); |
35 | 35 | }); |
0 commit comments