diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/authorsMap.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/authorsMap.test.ts index 9384bf6259a0..1522c5c3f55b 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/authorsMap.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/authorsMap.test.ts @@ -11,7 +11,6 @@ import { type AuthorsMapInput, checkAuthorsMapPermalinkCollisions, getAuthorsMap, - validateAuthorsMap, validateAuthorsMapInput, } from '../authorsMap'; import type {AuthorsMap} from '@docusaurus/plugin-content-blog'; @@ -305,7 +304,7 @@ describe('authors socials', () => { }, }; - expect(validateAuthorsMap(authorsMap)).toEqual(authorsMap); + expect(validateAuthorsMapInput(authorsMap)).toEqual(authorsMap); }); it('throw socials that are not strings', () => { @@ -338,17 +337,17 @@ describe('authors socials', () => { }; expect(() => - validateAuthorsMap(socialNumber), + validateAuthorsMapInput(socialNumber), ).toThrowErrorMatchingInlineSnapshot( `[ValidationError: "ozaki.socials.twitter" must be a string]`, ); expect(() => - validateAuthorsMap(socialNull), + validateAuthorsMapInput(socialNull), ).toThrowErrorMatchingInlineSnapshot( `[ValidationError: "ozaki.socials.twitter" must be a string]`, ); expect(() => - validateAuthorsMap(socialNull2), + validateAuthorsMapInput(socialNull2), ).toThrowErrorMatchingInlineSnapshot( `[ValidationError: "ozaki.socials" should be an author object containing properties like name, title, and imageURL.]`, ); @@ -366,7 +365,7 @@ describe('authors socials', () => { }; expect(() => - validateAuthorsMap(authorsMap), + validateAuthorsMapInput(authorsMap), ).toThrowErrorMatchingInlineSnapshot( `[ValidationError: "ozaki.socials.twitter" must be a string]`, ); @@ -384,6 +383,6 @@ describe('authors socials', () => { }, }; - expect(validateAuthorsMap(authorsMap)).toEqual(authorsMap); + expect(validateAuthorsMapInput(authorsMap)).toEqual(authorsMap); }); }); diff --git a/packages/docusaurus-plugin-content-blog/src/authorsMap.ts b/packages/docusaurus-plugin-content-blog/src/authorsMap.ts index e5c358b422f5..fd8f2eece562 100644 --- a/packages/docusaurus-plugin-content-blog/src/authorsMap.ts +++ b/packages/docusaurus-plugin-content-blog/src/authorsMap.ts @@ -168,11 +168,3 @@ export async function getAuthorsMap(params: { const authorsMap = normalizeAuthorsMap({authorsMapInput, ...params}); return authorsMap; } - -export function validateAuthorsMap(content: unknown): AuthorsMapInput { - const {error, value} = AuthorsMapInputSchema.validate(content); - if (error) { - throw error; - } - return value; -}