-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(v2): docs plugin stability improvement (100% test coverage) (#1912)
* update jest config * add more tests on docs plugin * fix(v2): docs plugin should not add routes if there are no docs * fix * rm -rf coverage * nits * update
- Loading branch information
Showing
26 changed files
with
465 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...urus-plugin-content-docs/src/__tests__/__fixtures__/bad-site/docs/invalid-id.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
id: hello/super | ||
--- | ||
|
||
Lorem |
16 changes: 16 additions & 0 deletions
16
...docusaurus-plugin-content-docs/src/__tests__/__fixtures__/empty-site/docusaurus.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) 2017-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
module.exports = { | ||
title: 'My Site', | ||
tagline: 'The tagline of my site', | ||
url: 'https://your-docusaurus-test-site.com', | ||
baseUrl: '/', | ||
favicon: 'img/favicon.ico', | ||
organizationName: 'facebook', // Usually your GitHub org/user name. | ||
projectName: 'docusaurus', // Usually your repo name. | ||
}; |
11 changes: 11 additions & 0 deletions
11
...lugin-content-docs/src/__tests__/__fixtures__/sidebars/sidebars-category-wrong-items.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"docs": { | ||
"Test": [ | ||
{ | ||
"type": "category", | ||
"label": "Category Label", | ||
"items": "doc1" | ||
} | ||
] | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
...usaurus-plugin-content-docs/src/__tests__/__fixtures__/sidebars/sidebars-wrong-field.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"docs": { | ||
"Test": [ | ||
"foo/bar", | ||
"foo/baz", | ||
{ | ||
"type": "category", | ||
"label": "category", | ||
"href": "https://github.com" | ||
}, | ||
{ | ||
"type": "ref", | ||
"id": "hello" | ||
} | ||
], | ||
"Guides": [ | ||
"hello" | ||
] | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...ests__/__fixtures__/website/docs/lorem.md → ...__/__fixtures__/simple-site/docs/lorem.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
--- | ||
id: lorem | ||
custom_edit_url: https://github.com/customUrl/docs/lorem.md | ||
--- | ||
|
||
|
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
...ocusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/docusaurus.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) 2017-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
module.exports = { | ||
title: 'My Site', | ||
tagline: 'The tagline of my site', | ||
url: 'https://your-docusaurus-test-site.com', | ||
baseUrl: '/', | ||
favicon: 'img/favicon.ico', | ||
organizationName: 'facebook', // Usually your GitHub org/user name. | ||
projectName: 'docusaurus', // Usually your repo name. | ||
}; |
23 changes: 23 additions & 0 deletions
23
packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/sidebars.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"docs": { | ||
"Test": [ | ||
{ | ||
"type": "category", | ||
"label": "foo", | ||
"items": ["foo/bar", "foo/baz"] | ||
}, | ||
{ | ||
"type": "link", | ||
"label": "Github", | ||
"href": "https://github.com" | ||
}, | ||
{ | ||
"type": "ref", | ||
"id": "hello" | ||
} | ||
], | ||
"Guides": [ | ||
"hello" | ||
] | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/wrong-sidebars.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"docs": { | ||
"Test": [ | ||
"goku" | ||
] | ||
} | ||
} |
110 changes: 110 additions & 0 deletions
110
packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`simple website content 1`] = ` | ||
Object { | ||
"docs": Array [ | ||
Object { | ||
"items": Array [ | ||
Object { | ||
"items": Array [ | ||
Object { | ||
"href": "/docs/foo/bar", | ||
"label": "Bar", | ||
"type": "link", | ||
}, | ||
Object { | ||
"href": "/docs/foo/baz", | ||
"label": "baz", | ||
"type": "link", | ||
}, | ||
], | ||
"label": "foo", | ||
"type": "category", | ||
}, | ||
Object { | ||
"href": "https://github.com", | ||
"label": "Github", | ||
"type": "link", | ||
}, | ||
Object { | ||
"href": "/docs/hello", | ||
"label": "Hello, World !", | ||
"type": "link", | ||
}, | ||
], | ||
"label": "Test", | ||
"type": "category", | ||
}, | ||
Object { | ||
"items": Array [ | ||
Object { | ||
"href": "/docs/hello", | ||
"label": "Hello, World !", | ||
"type": "link", | ||
}, | ||
], | ||
"label": "Guides", | ||
"type": "category", | ||
}, | ||
], | ||
} | ||
`; | ||
|
||
exports[`simple website content 2`] = ` | ||
Array [ | ||
Object { | ||
"component": "@theme/DocPage", | ||
"modules": Object { | ||
"docsMetadata": "@docusaurus-plugin-content-docs/docs-b5f.json", | ||
}, | ||
"path": "/docs", | ||
"routes": Array [ | ||
Object { | ||
"component": "@theme/DocItem", | ||
"exact": true, | ||
"modules": Object { | ||
"content": "@site/docs/permalink.md", | ||
"metadata": "@docusaurus-plugin-content-docs/docs-endiliey-permalink-086.json", | ||
}, | ||
"path": "/docs/endiliey/permalink", | ||
}, | ||
Object { | ||
"component": "@theme/DocItem", | ||
"exact": true, | ||
"modules": Object { | ||
"content": "@site/docs/foo/bar.md", | ||
"metadata": "@docusaurus-plugin-content-docs/docs-foo-bar-cef.json", | ||
}, | ||
"path": "/docs/foo/bar", | ||
}, | ||
Object { | ||
"component": "@theme/DocItem", | ||
"exact": true, | ||
"modules": Object { | ||
"content": "@site/docs/foo/baz.md", | ||
"metadata": "@docusaurus-plugin-content-docs/docs-foo-baz-dd9.json", | ||
}, | ||
"path": "/docs/foo/baz", | ||
}, | ||
Object { | ||
"component": "@theme/DocItem", | ||
"exact": true, | ||
"modules": Object { | ||
"content": "@site/docs/hello.md", | ||
"metadata": "@docusaurus-plugin-content-docs/docs-hello-da2.json", | ||
}, | ||
"path": "/docs/hello", | ||
}, | ||
Object { | ||
"component": "@theme/DocItem", | ||
"exact": true, | ||
"modules": Object { | ||
"content": "@site/docs/lorem.md", | ||
"metadata": "@docusaurus-plugin-content-docs/docs-lorem-17b.json", | ||
}, | ||
"path": "/docs/lorem", | ||
}, | ||
], | ||
}, | ||
] | ||
`; |
Oops, something went wrong.