mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 20:57:17 +02:00
test: docs ordering from sidebar
This commit is contained in:
parent
0365403a75
commit
4d10c3b8f3
2 changed files with 52 additions and 61 deletions
|
@ -1,59 +0,0 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`createOrder should populate docs index from multiple sidebars 1`] = `
|
|
||||||
Object {
|
|
||||||
"doc1": Object {
|
|
||||||
"category": "Category1",
|
|
||||||
"next": "doc2",
|
|
||||||
"previous": undefined,
|
|
||||||
"sidebar": "docs",
|
|
||||||
},
|
|
||||||
"doc2": Object {
|
|
||||||
"category": "Category1",
|
|
||||||
"next": "doc3",
|
|
||||||
"previous": "doc1",
|
|
||||||
"sidebar": "docs",
|
|
||||||
},
|
|
||||||
"doc3": Object {
|
|
||||||
"category": "Category2",
|
|
||||||
"next": "doc4",
|
|
||||||
"previous": "doc2",
|
|
||||||
"sidebar": "docs",
|
|
||||||
},
|
|
||||||
"doc4": Object {
|
|
||||||
"category": "Category2",
|
|
||||||
"next": undefined,
|
|
||||||
"previous": "doc3",
|
|
||||||
"sidebar": "docs",
|
|
||||||
},
|
|
||||||
"doc5": Object {
|
|
||||||
"category": "Category1",
|
|
||||||
"next": undefined,
|
|
||||||
"previous": undefined,
|
|
||||||
"sidebar": "otherDocs",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`createOrder should resolve docs from older versions 1`] = `
|
|
||||||
Object {
|
|
||||||
"doc1": Object {
|
|
||||||
"category": "Category1",
|
|
||||||
"next": undefined,
|
|
||||||
"previous": undefined,
|
|
||||||
"sidebar": "docs",
|
|
||||||
},
|
|
||||||
"version-1.2.3-doc1": Object {
|
|
||||||
"category": "Category2",
|
|
||||||
"next": undefined,
|
|
||||||
"previous": "version-1.2.3-doc2",
|
|
||||||
"sidebar": "version-1.2.3-docs",
|
|
||||||
},
|
|
||||||
"version-1.2.3-doc2": Object {
|
|
||||||
"category": "Category1",
|
|
||||||
"next": "version-1.2.3-doc1",
|
|
||||||
"previous": undefined,
|
|
||||||
"sidebar": "version-1.2.3-docs",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`;
|
|
|
@ -11,7 +11,38 @@ describe('createOrder', () => {
|
||||||
Category1: ['doc5']
|
Category1: ['doc5']
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
expect(result).toMatchSnapshot();
|
expect(result).toEqual({
|
||||||
|
doc1: {
|
||||||
|
category: 'Category1',
|
||||||
|
next: 'doc2',
|
||||||
|
previous: undefined,
|
||||||
|
sidebar: 'docs'
|
||||||
|
},
|
||||||
|
doc2: {
|
||||||
|
category: 'Category1',
|
||||||
|
next: 'doc3',
|
||||||
|
previous: 'doc1',
|
||||||
|
sidebar: 'docs'
|
||||||
|
},
|
||||||
|
doc3: {
|
||||||
|
category: 'Category2',
|
||||||
|
next: 'doc4',
|
||||||
|
previous: 'doc2',
|
||||||
|
sidebar: 'docs'
|
||||||
|
},
|
||||||
|
doc4: {
|
||||||
|
category: 'Category2',
|
||||||
|
next: undefined,
|
||||||
|
previous: 'doc3',
|
||||||
|
sidebar: 'docs'
|
||||||
|
},
|
||||||
|
doc5: {
|
||||||
|
category: 'Category1',
|
||||||
|
next: undefined,
|
||||||
|
previous: undefined,
|
||||||
|
sidebar: 'otherDocs'
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should resolve docs from older versions', () => {
|
test('should resolve docs from older versions', () => {
|
||||||
|
@ -24,7 +55,26 @@ describe('createOrder', () => {
|
||||||
Category2: ['version-1.2.3-doc1']
|
Category2: ['version-1.2.3-doc1']
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
expect(result).toMatchSnapshot();
|
expect(result).toEqual({
|
||||||
|
doc1: {
|
||||||
|
category: 'Category1',
|
||||||
|
next: undefined,
|
||||||
|
previous: undefined,
|
||||||
|
sidebar: 'docs'
|
||||||
|
},
|
||||||
|
'version-1.2.3-doc1': {
|
||||||
|
category: 'Category2',
|
||||||
|
next: undefined,
|
||||||
|
previous: 'version-1.2.3-doc2',
|
||||||
|
sidebar: 'version-1.2.3-docs'
|
||||||
|
},
|
||||||
|
'version-1.2.3-doc2': {
|
||||||
|
category: 'Category1',
|
||||||
|
next: 'version-1.2.3-doc1',
|
||||||
|
previous: undefined,
|
||||||
|
sidebar: 'version-1.2.3-docs'
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('edge cases', () => {
|
test('edge cases', () => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue