Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Sep 2, 2021
1 parent 74017df commit b2a7481
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 39 deletions.
32 changes: 0 additions & 32 deletions src/__tests__/file-structure.test.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/__tests__/list-folder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ describe('test file-structure', () => {
{ ext: '.js', folder: 'src/lib/index', isDir: false, name: '_index', path: 'src/lib/index.js' },
{ isDir: true, name: 'lib', path: 'src/lib' }
]);

expect((await listFolder('./src', [])).tree).toEqual([
{ fullPath: 'src/file1', name: 'file1', path: '/file1' },
{ fullPath: 'src/file2', name: 'file2', path: '/file2' },
{
children: [
{ fullPath: 'src/lib/file3', name: 'file3', path: '/file3' },
{ fullPath: 'src/lib/index', name: 'index', path: '/index' }
{ fullPath: 'src/lib/_index', name: '_index', path: '/_index' }
],
name: 'lib'
}
Expand Down
10 changes: 4 additions & 6 deletions src/__tests__/sidebar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ describe('test sidebar', () => {
test('generateVueSidebar should return valid vue config', () => {
const codeFolder = 'test_folder';
const title = 'test_folder';
const srcFolder = 'test_folder';

const fileTree = [
{ name: 'class', path: '/class', fullPath: './documentation/test_folder/class' },
{
Expand All @@ -25,19 +27,15 @@ describe('test sidebar', () => {
{ name: 'tests', children: [] }
];

const sidebar = generateVueSidebar({ fileTree, codeFolder, title });
const sidebar = generateVueSidebar({ fileTree, codeFolder, srcFolder, 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'
]
children: ['./documentation/test1', './documentation/test2/test3', './documentation/test2/test4']
}
]
};
Expand Down

0 comments on commit b2a7481

Please sign in to comment.