mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
chore: prepare for docs sidebar
This commit is contained in:
parent
2141e6ea90
commit
b477863a30
9 changed files with 350 additions and 2 deletions
35
test/load/docs/order.test.js
Normal file
35
test/load/docs/order.test.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
import createOrder from '@lib/load/docs/order';
|
||||
|
||||
describe('createOrder', () => {
|
||||
test('should populate docs index from multiple sidebars', () => {
|
||||
const result = createOrder({
|
||||
docs: {
|
||||
Category1: ['doc1', 'doc2'],
|
||||
Category2: ['doc3', 'doc4']
|
||||
},
|
||||
otherDocs: {
|
||||
Category1: ['doc5']
|
||||
}
|
||||
});
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should resolve docs from older versions', () => {
|
||||
const result = createOrder({
|
||||
docs: {
|
||||
Category1: ['doc1']
|
||||
},
|
||||
'version-1.2.3-docs': {
|
||||
Category1: ['version-1.2.3-doc2'],
|
||||
Category2: ['version-1.2.3-doc1']
|
||||
}
|
||||
});
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('edge cases', () => {
|
||||
expect(createOrder({})).toEqual({});
|
||||
expect(createOrder(null)).toEqual({});
|
||||
expect(createOrder(undefined)).toEqual({});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue