mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-28 19:06:12 +01:00
fc02581a10
When all edge documentation was in a single page, we had all of it here: https://docs.getunleash.io/reference/unleash-edge but after splitting up https://github.com/Unleash/unleash-edge/pull/475 some of that documentation is not present in our docs and we should probably have them as sub-pages This change allows us to include subpages for external documentation. Note that the key of the subpage needs to match the remote path Checkout the preview: https://unleash-docs-git-add-edge-subpages-unleash-team.vercel.app/ ![image](https://github.com/user-attachments/assets/4b87fe25-fca6-4995-b296-aa58caab4f62) --------- Co-authored-by: Thomas Heartman <thomas@getunleash.io>
37 lines
1.5 KiB
JavaScript
37 lines
1.5 KiB
JavaScript
const { docs } = require('./edge-proxy');
|
|
|
|
test('Should get all sub pages', () => {
|
|
expect(docs.urls).toStrictEqual([
|
|
'unleash-proxy/main/README.md',
|
|
'unleash-edge/main/README.md',
|
|
'unleash-edge/main/docs/concepts.md',
|
|
'unleash-edge/main/docs/deploying.md',
|
|
]);
|
|
});
|
|
|
|
test('Modifies filenames and content properly', () => {
|
|
const proxyContent = docs.modifyContent(docs.urls[0], '');
|
|
const edgeMainContent = docs.modifyContent(docs.urls[1], '');
|
|
const firstSubpage = docs.modifyContent(docs.urls[2], '');
|
|
const secondSubpage = docs.modifyContent(docs.urls[3], '');
|
|
|
|
expect(proxyContent.filename).toBe('unleash-proxy.md');
|
|
expect(edgeMainContent.filename).toBe('unleash-edge.md');
|
|
expect(firstSubpage.filename).toBe('unleash-edge/concepts.md');
|
|
expect(secondSubpage.filename).toBe('unleash-edge/deploying.md');
|
|
|
|
expect(edgeMainContent.content).toContain('title: Unleash Edge');
|
|
expect(edgeMainContent.content).toContain('slug: /reference/unleash-edge');
|
|
expect(edgeMainContent.content).toContain(
|
|
'custom_edit_url: https://github.com/Unleash/unleash-edge/edit/main/README.md',
|
|
);
|
|
|
|
expect(firstSubpage.content).toContain('title: Concepts');
|
|
expect(firstSubpage.content).toContain(
|
|
'slug: /reference/unleash-edge/concepts',
|
|
);
|
|
expect(firstSubpage.content).toContain(
|
|
'custom_edit_url: https://github.com/Unleash/unleash-edge/edit/main/docs/concepts.md',
|
|
);
|
|
});
|