-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(sidebar): add sidebar test and add async foreach test
fix coverage
- Loading branch information
Showing
5 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
# for Jetbrains IDEA ides | ||
.idea | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict'; | ||
|
||
const vueSidebar = require('../helpers/vue-sidebar'); | ||
|
||
describe('test sidebar', () => { | ||
test('vueSidebar should return valid vue config', () => { | ||
const codeFolder = 'test_folder'; | ||
const title = 'test_folder'; | ||
const fileTree = [ | ||
{ name: 'class', path: '/class', fullPath: './documentation/test_folder/class' }, | ||
{ | ||
name: 'lib', | ||
children: [ | ||
{ name: 'test1', path: '/test1', fullPath: './documentation/test_folder/test1' }, | ||
{ | ||
name: 'test2', | ||
path: '/test2', | ||
fullPath: './documentation/test_folder/test2', | ||
children: [ | ||
{ name: 'test3', path: '/test3', fullPath: './documentation/test_folder/test2/test3' }, | ||
{ name: 'test4', path: '/test4', fullPath: './documentation/test_folder/test2/test4' } | ||
] | ||
} | ||
] | ||
}, | ||
{ name: 'test', path: '/test', fullPath: './documentation/test_folder/test' }, | ||
{ name: 'tests', children: [] } | ||
]; | ||
|
||
const sidebar = vueSidebar({ fileTree, codeFolder, title }); | ||
|
||
const result = { | ||
[`/${codeFolder}/`]: [ | ||
{ title, collapsable: false, children: [['', '::vuepress-jsdoc-title::'], 'class', 'test'] }, | ||
{ | ||
title: 'lib', | ||
collapsable: false, | ||
children: [ | ||
'./documentation/test_folder/test1', | ||
'./documentation/test_folder/test2/test3', | ||
'./documentation/test_folder/test2/test4' | ||
] | ||
} | ||
] | ||
}; | ||
|
||
expect(sidebar).toEqual(result); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters