mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-29 17:07:08 +02:00
feat(content-blog): allow sorting posts in ascending order (#5787)
This commit is contained in:
parent
8fba542d26
commit
1c024470e0
5 changed files with 20 additions and 0 deletions
|
@ -394,4 +394,15 @@ describe('loadBlog', () => {
|
|||
truncated: false,
|
||||
});
|
||||
});
|
||||
|
||||
test('test ascending sort direction of blog post', async () => {
|
||||
const siteDir = path.join(__dirname, '__fixtures__', 'website');
|
||||
const normalOrder = await getBlogPosts(siteDir);
|
||||
const reversedOrder = await getBlogPosts(siteDir, {
|
||||
sortPosts: 'ascending',
|
||||
});
|
||||
expect(normalOrder.reverse().map((x) => x.metadata.date)).toEqual(
|
||||
reversedOrder.map((x) => x.metadata.date),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue