diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts index a1ee875ba8a7..70f5f65a6042 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts @@ -473,4 +473,20 @@ describe('blog sort', () => { }); expect(sortedBlogPosts).toEqual(ascendingBlogPost); }); + + it('sort blog posts with empty function', () => { + const sortedBlogPosts = sortBlogPosts({ + blogPosts: BlogPostList, + sortPosts: () => {}, + }); + expect(sortedBlogPosts).toEqual(ascendingBlogPost); + }); + + it('sort blog posts with function return empty array', () => { + const sortedBlogPosts = sortBlogPosts({ + blogPosts: BlogPostList, + sortPosts: () => [], + }); + expect(sortedBlogPosts).toEqual(ascendingBlogPost); + }); });