mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-27 05:28:43 +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
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import {normalizeUrl} from '@docusaurus/utils';
|
||||
import type {Sidebars} from './sidebars/types';
|
||||
import {createSidebarsUtils} from './sidebars/utils';
|
||||
import type {
|
||||
|
@ -20,7 +19,7 @@ import type {
|
|||
GlobalDoc,
|
||||
} from '@docusaurus/plugin-content-docs/client';
|
||||
|
||||
export function toGlobalDataDoc(doc: DocMetadata): GlobalDoc {
|
||||
function toGlobalDataDoc(doc: DocMetadata): GlobalDoc {
|
||||
return {
|
||||
id: doc.unversionedId,
|
||||
path: doc.permalink,
|
||||
|
@ -28,7 +27,7 @@ export function toGlobalDataDoc(doc: DocMetadata): GlobalDoc {
|
|||
};
|
||||
}
|
||||
|
||||
export function toGlobalDataGeneratedIndex(
|
||||
function toGlobalDataGeneratedIndex(
|
||||
doc: CategoryGeneratedIndexMetadata,
|
||||
): GlobalDoc {
|
||||
return {
|
||||
|
@ -38,7 +37,7 @@ export function toGlobalDataGeneratedIndex(
|
|||
};
|
||||
}
|
||||
|
||||
export function toGlobalSidebars(
|
||||
function toGlobalSidebars(
|
||||
sidebars: Sidebars,
|
||||
version: LoadedVersion,
|
||||
): Record<string, GlobalSidebar> {
|
||||
|
@ -52,7 +51,7 @@ export function toGlobalSidebars(
|
|||
link: {
|
||||
path:
|
||||
firstLink.type === 'generated-index'
|
||||
? normalizeUrl([version.versionPath, firstLink.slug])
|
||||
? firstLink.permalink
|
||||
: version.docs.find(
|
||||
(doc) =>
|
||||
doc.id === firstLink.id || doc.unversionedId === firstLink.id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue