mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
test: improve test coverage; properly test core client APIs (#6905)
* test: improve test coverage * fix
This commit is contained in:
parent
76cb012209
commit
d85cee576d
41 changed files with 1400 additions and 753 deletions
|
@ -391,6 +391,10 @@ export const isCategoryIndex: CategoryIndexMatcher = ({
|
|||
return eligibleDocIndexNames.includes(fileName.toLowerCase());
|
||||
};
|
||||
|
||||
/**
|
||||
* `guides/sidebar/autogenerated.md` ->
|
||||
* `'autogenerated', '.md', ['sidebar', 'guides']`
|
||||
*/
|
||||
export function toCategoryIndexMatcherParam({
|
||||
source,
|
||||
sourceDirName,
|
||||
|
@ -406,28 +410,6 @@ export function toCategoryIndexMatcherParam({
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* `guides/sidebar/autogenerated.md` ->
|
||||
* `'autogenerated', '.md', ['sidebar', 'guides']`
|
||||
*/
|
||||
export function splitPath(str: string): {
|
||||
/**
|
||||
* The list of directories, from lowest level to highest.
|
||||
* If there's no dir name, directories is ['.']
|
||||
*/
|
||||
directories: string[];
|
||||
/** The file name, without extension */
|
||||
fileName: string;
|
||||
/** The extension, with a leading dot */
|
||||
extension: string;
|
||||
} {
|
||||
return {
|
||||
fileName: path.parse(str).name,
|
||||
extension: path.parse(str).ext,
|
||||
directories: path.dirname(str).split(path.sep).reverse(),
|
||||
};
|
||||
}
|
||||
|
||||
// Return both doc ids
|
||||
// TODO legacy retro-compatibility due to old versioned sidebars using
|
||||
// versioned doc ids ("id" should be removed & "versionedId" should be renamed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue