From deda01a83ae3bd2db0cfa2d8e93e8bebbe76e9ef Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Wed, 26 Oct 2022 02:15:20 -0400 Subject: [PATCH] Fix tests --- .../src/__tests__/index.test.ts | 6 +++++- packages/docusaurus-plugin-content-docs/src/docs.ts | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts index 7598112f1362b..4a4c1d46022ea 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts @@ -145,7 +145,11 @@ describe('sidebar', () => { }, }), ); - await expect(plugin.loadContent!()).rejects.toThrowErrorMatchingSnapshot(); + const content = await plugin.loadContent!(); + const {actions} = createFakeActions(siteDir); + await expect( + plugin.contentLoaded!({content, actions, allContent: {}}), + ).rejects.toThrowErrorMatchingSnapshot(); }); it('site with wrong sidebar file path', async () => { diff --git a/packages/docusaurus-plugin-content-docs/src/docs.ts b/packages/docusaurus-plugin-content-docs/src/docs.ts index 7d13e40eb8cd9..ff46666ad8145 100644 --- a/packages/docusaurus-plugin-content-docs/src/docs.ts +++ b/packages/docusaurus-plugin-content-docs/src/docs.ts @@ -36,7 +36,6 @@ import type { LastUpdateData, VersionMetadata, DocFrontMatter, - LoadedVersion, FileChange, } from '@docusaurus/plugin-content-docs'; import type {LoadContext} from '@docusaurus/types'; @@ -335,7 +334,7 @@ export function addDocNavigation( docsBase: DocMetadataBase[], sidebarsUtils: SidebarsUtils, sidebarFilePath: string, -): LoadedVersion['docs'] { +): DocMetadata[] { const docsById = createDocsByIdIndex(docsBase); sidebarsUtils.checkSidebarsDocIds(