mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-16 18:46:57 +02:00
test: improve test coverage (#6387)
* test: improve test coverage * fix * use posixPath
This commit is contained in:
parent
a9810db1cc
commit
62223ee556
24 changed files with 463 additions and 60 deletions
|
@ -201,7 +201,9 @@ describe('DefaultSidebarItemsGenerator', () => {
|
|||
source: 'guide1.md',
|
||||
sourceDirName: '02-Guides',
|
||||
sidebarPosition: 1,
|
||||
frontMatter: {},
|
||||
frontMatter: {
|
||||
sidebar_class_name: 'foo',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'nested-guide',
|
||||
|
@ -250,7 +252,7 @@ describe('DefaultSidebarItemsGenerator', () => {
|
|||
id: 'guides-index',
|
||||
},
|
||||
items: [
|
||||
{type: 'doc', id: 'guide1'},
|
||||
{type: 'doc', id: 'guide1', className: 'foo'},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'SubGuides (metadata file label)',
|
||||
|
@ -278,12 +280,17 @@ describe('DefaultSidebarItemsGenerator', () => {
|
|||
'subfolder/subsubfolder/subsubsubfolder2/_category_.yml': {
|
||||
position: 2,
|
||||
label: 'subsubsubfolder2 (_category_.yml label)',
|
||||
className: 'bar',
|
||||
},
|
||||
'subfolder/subsubfolder/subsubsubfolder3/_category_.json': {
|
||||
position: 1,
|
||||
label: 'subsubsubfolder3 (_category_.json label)',
|
||||
collapsible: false,
|
||||
collapsed: false,
|
||||
link: {
|
||||
type: 'doc',
|
||||
id: 'doc1', // This is a "fully-qualified" ID that can't be found locally
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -367,6 +374,10 @@ describe('DefaultSidebarItemsGenerator', () => {
|
|||
label: 'subsubsubfolder3 (_category_.json label)',
|
||||
collapsed: false,
|
||||
collapsible: false,
|
||||
link: {
|
||||
id: 'doc1',
|
||||
type: 'doc',
|
||||
},
|
||||
items: [
|
||||
{type: 'doc', id: 'doc8'},
|
||||
{type: 'doc', id: 'doc7'},
|
||||
|
@ -377,6 +388,7 @@ describe('DefaultSidebarItemsGenerator', () => {
|
|||
label: 'subsubsubfolder2 (_category_.yml label)',
|
||||
collapsed: true,
|
||||
collapsible: true,
|
||||
className: 'bar',
|
||||
items: [{type: 'doc', id: 'doc6'}],
|
||||
},
|
||||
{type: 'doc', id: 'doc1'},
|
||||
|
|
|
@ -102,8 +102,8 @@ describe('processSidebars', () => {
|
|||
slug: 'category-generated-index-slug',
|
||||
permalink: 'category-generated-index-permalink',
|
||||
},
|
||||
collapsed: false,
|
||||
collapsible: true,
|
||||
collapsed: true, // A suspicious bad config that will be normalized
|
||||
collapsible: false,
|
||||
items: [
|
||||
{type: 'doc', id: 'doc2'},
|
||||
{type: 'autogenerated', dirName: 'dir1'},
|
||||
|
@ -172,7 +172,7 @@ describe('processSidebars', () => {
|
|||
permalink: 'category-generated-index-permalink',
|
||||
},
|
||||
collapsed: false,
|
||||
collapsible: true,
|
||||
collapsible: false,
|
||||
items: [{type: 'doc', id: 'doc2'}, ...StaticGeneratedSidebarSlice],
|
||||
},
|
||||
{type: 'link', href: 'https://facebook.com', label: 'FB'},
|
||||
|
|
|
@ -96,6 +96,14 @@ describe('createSidebarsUtils', () => {
|
|||
];
|
||||
|
||||
const sidebar4: Sidebar = [
|
||||
{
|
||||
type: 'category',
|
||||
items: [
|
||||
{type: 'link', href: 'https://facebook.com'},
|
||||
{type: 'link', href: 'https://reactjs.org'},
|
||||
{type: 'link', href: 'https://docusaurus.io'},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
collapsed: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue