mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-31 07:18:59 +02:00
chore: spell-check test files (#6903)
This commit is contained in:
parent
f6baaa6b75
commit
76cb012209
59 changed files with 184 additions and 155 deletions
|
@ -70,6 +70,6 @@ Term 2 ~ Definition 2a ~ Definition 2b
|
|||
|
||||
This is HTML abbreviation example.
|
||||
|
||||
It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.
|
||||
It converts "HTML", but keep intact partial entries like "xxxHTMLxxx" and so on.
|
||||
|
||||
\*[HTML]: Hyper Text Markup Language
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"docs": {
|
||||
"Test": [
|
||||
"goku"
|
||||
"nonExistent"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ Object {
|
|||
exports[`sidebar site with wrong sidebar content 1`] = `
|
||||
"Invalid sidebar file at \\"packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/wrong-sidebars.json\\".
|
||||
These sidebar document ids do not exist:
|
||||
- goku
|
||||
- nonExistent
|
||||
|
||||
Available document ids are:
|
||||
- doc with space
|
||||
|
|
|
@ -13,7 +13,7 @@ function testField(params: {
|
|||
prefix: string;
|
||||
validFrontMatters: DocFrontMatter[];
|
||||
convertibleFrontMatter?: [
|
||||
ConvertableFrontMatter: Record<string, unknown>,
|
||||
ConvertibleFrontMatter: Record<string, unknown>,
|
||||
ConvertedFrontMatter: DocFrontMatter,
|
||||
][];
|
||||
invalidFrontMatters?: [
|
||||
|
|
|
@ -502,14 +502,14 @@ describe('simple site', () => {
|
|||
const docs = await readVersionDocs(versionsMetadata[0], options);
|
||||
docs.push(
|
||||
createFakeDocFile({
|
||||
source: 'hehe',
|
||||
source: 'bad',
|
||||
frontMatter: {pagination_prev: 'nonexistent'},
|
||||
}),
|
||||
);
|
||||
await expect(
|
||||
defaultTestUtils.generateNavigation(docs),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Error when loading hehe in .: the pagination_prev front matter points to a non-existent ID nonexistent."`,
|
||||
`"Error when loading bad in .: the pagination_prev front matter points to a non-existent ID nonexistent."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -201,15 +201,11 @@ describe('empty/no docs website', () => {
|
|||
pluginContentDocs(
|
||||
context,
|
||||
normalizePluginOptions(OptionsSchema, {
|
||||
path: `path/doesnt/exist`,
|
||||
path: `path/does/not/exist`,
|
||||
}),
|
||||
),
|
||||
).rejects.toThrowError(
|
||||
`The docs folder does not exist for version "current". A docs folder is expected to be found at ${
|
||||
process.platform === 'win32'
|
||||
? 'path\\doesnt\\exist'
|
||||
: 'path/doesnt/exist'
|
||||
}.`,
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"The docs folder does not exist for version \\"current\\". A docs folder is expected to be found at path/does/not/exist."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -167,11 +167,11 @@ describe('getSlug', () => {
|
|||
expect(
|
||||
getSlug({
|
||||
baseID: 'any',
|
||||
source: '@site/docs/unslashedDir/doc.md',
|
||||
sourceDirName: 'unslashedDir',
|
||||
source: '@site/docs/nonSlashedDir/doc.md',
|
||||
sourceDirName: 'nonSlashedDir',
|
||||
frontMatterSlug: 'abc/def',
|
||||
}),
|
||||
).toBe('/unslashedDir/abc/def');
|
||||
).toBe('/nonSlashedDir/abc/def');
|
||||
expect(
|
||||
getSlug({
|
||||
baseID: 'any',
|
||||
|
@ -207,7 +207,7 @@ describe('getSlug', () => {
|
|||
expect(
|
||||
getSlug({
|
||||
baseID: 'any',
|
||||
source: '@site/docs/dir/subdirdoc.md',
|
||||
source: '@site/docs/dir/subdirDoc.md',
|
||||
sourceDirName: '/dir/subdir',
|
||||
frontMatterSlug: '../../../../../abc/../def',
|
||||
}),
|
||||
|
|
|
@ -290,7 +290,7 @@ describe('versioned site, pluginId=default', () => {
|
|||
versionClassName: 'docs-version-1.0.0',
|
||||
};
|
||||
|
||||
const vwithSlugs: VersionMetadata = {
|
||||
const vWithSlugs: VersionMetadata = {
|
||||
contentPath: path.join(
|
||||
versionedSiteDir,
|
||||
'versioned_docs/version-withSlugs',
|
||||
|
@ -321,12 +321,12 @@ describe('versioned site, pluginId=default', () => {
|
|||
vCurrent,
|
||||
v101,
|
||||
v100,
|
||||
vwithSlugs,
|
||||
vWithSlugs,
|
||||
};
|
||||
}
|
||||
|
||||
it('readVersionsMetadata versioned site', async () => {
|
||||
const {defaultOptions, defaultContext, vCurrent, v101, v100, vwithSlugs} =
|
||||
const {defaultOptions, defaultContext, vCurrent, v101, v100, vWithSlugs} =
|
||||
await loadSite();
|
||||
|
||||
const versionsMetadata = await readVersionsMetadata({
|
||||
|
@ -334,11 +334,11 @@ describe('versioned site, pluginId=default', () => {
|
|||
context: defaultContext,
|
||||
});
|
||||
|
||||
expect(versionsMetadata).toEqual([vCurrent, v101, v100, vwithSlugs]);
|
||||
expect(versionsMetadata).toEqual([vCurrent, v101, v100, vWithSlugs]);
|
||||
});
|
||||
|
||||
it('readVersionsMetadata versioned site with includeCurrentVersion=false', async () => {
|
||||
const {defaultOptions, defaultContext, v101, v100, vwithSlugs} =
|
||||
const {defaultOptions, defaultContext, v101, v100, vWithSlugs} =
|
||||
await loadSite();
|
||||
|
||||
const versionsMetadata = await readVersionsMetadata({
|
||||
|
@ -350,12 +350,12 @@ describe('versioned site, pluginId=default', () => {
|
|||
// vCurrent removed
|
||||
v101,
|
||||
v100,
|
||||
vwithSlugs,
|
||||
vWithSlugs,
|
||||
]);
|
||||
});
|
||||
|
||||
it('readVersionsMetadata versioned site with version options', async () => {
|
||||
const {defaultOptions, defaultContext, vCurrent, v101, v100, vwithSlugs} =
|
||||
const {defaultOptions, defaultContext, vCurrent, v101, v100, vWithSlugs} =
|
||||
await loadSite();
|
||||
|
||||
const versionsMetadata = await readVersionsMetadata({
|
||||
|
@ -404,12 +404,12 @@ describe('versioned site, pluginId=default', () => {
|
|||
versionPath: '/docs',
|
||||
versionBanner: 'unreleased',
|
||||
},
|
||||
vwithSlugs,
|
||||
vWithSlugs,
|
||||
]);
|
||||
});
|
||||
|
||||
it('readVersionsMetadata versioned site with editUrl', async () => {
|
||||
const {defaultOptions, defaultContext, vCurrent, v101, v100, vwithSlugs} =
|
||||
const {defaultOptions, defaultContext, vCurrent, v101, v100, vWithSlugs} =
|
||||
await loadSite();
|
||||
|
||||
const versionsMetadata = await readVersionsMetadata({
|
||||
|
@ -443,7 +443,7 @@ describe('versioned site, pluginId=default', () => {
|
|||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/version-1.0.0',
|
||||
},
|
||||
{
|
||||
...vwithSlugs,
|
||||
...vWithSlugs,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-withSlugs',
|
||||
versionEditUrlLocalized:
|
||||
|
@ -453,7 +453,7 @@ describe('versioned site, pluginId=default', () => {
|
|||
});
|
||||
|
||||
it('readVersionsMetadata versioned site with editUrl and editCurrentVersion=true', async () => {
|
||||
const {defaultOptions, defaultContext, vCurrent, v101, v100, vwithSlugs} =
|
||||
const {defaultOptions, defaultContext, vCurrent, v101, v100, vWithSlugs} =
|
||||
await loadSite();
|
||||
|
||||
const versionsMetadata = await readVersionsMetadata({
|
||||
|
@ -488,7 +488,7 @@ describe('versioned site, pluginId=default', () => {
|
|||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
},
|
||||
{
|
||||
...vwithSlugs,
|
||||
...vWithSlugs,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs',
|
||||
versionEditUrlLocalized:
|
||||
|
@ -498,18 +498,18 @@ describe('versioned site, pluginId=default', () => {
|
|||
});
|
||||
|
||||
it('readVersionsMetadata versioned site with onlyIncludeVersions option', async () => {
|
||||
const {defaultOptions, defaultContext, v101, vwithSlugs} = await loadSite();
|
||||
const {defaultOptions, defaultContext, v101, vWithSlugs} = await loadSite();
|
||||
|
||||
const versionsMetadata = await readVersionsMetadata({
|
||||
options: {
|
||||
...defaultOptions,
|
||||
// Order reversed on purpose: should not have any impact
|
||||
onlyIncludeVersions: [vwithSlugs.versionName, v101.versionName],
|
||||
onlyIncludeVersions: [vWithSlugs.versionName, v101.versionName],
|
||||
},
|
||||
context: defaultContext,
|
||||
});
|
||||
|
||||
expect(versionsMetadata).toEqual([v101, vwithSlugs]);
|
||||
expect(versionsMetadata).toEqual([v101, vWithSlugs]);
|
||||
});
|
||||
|
||||
it('readVersionsMetadata versioned site with disableVersioning', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue