chore: spell-check test files (#6903)

This commit is contained in:
Joshua Chen 2022-03-12 15:24:56 +08:00 committed by GitHub
parent f6baaa6b75
commit 76cb012209
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 184 additions and 155 deletions

View file

@ -21,12 +21,11 @@
],
"ignorePaths": [
"CHANGELOG.md",
"examples",
"packages/docusaurus-theme-translations/locales",
"__tests__",
"package.json",
"yarn.lock",
"project-words.txt",
"__snapshots__",
"website/src/data/users.tsx",
"website/src/data/tweets.tsx",
"*.xyz",

View file

@ -47,7 +47,7 @@ describe('packages', () => {
/*
If a package starts with @, if won't be published to public npm registry
without an additional publishConfig.acces: "public" config
without an additional publishConfig.access: "public" config
This will make you publish an incomplete list of Docusaurus packages
when trying to release with lerna-publish
*/

View file

@ -10,6 +10,7 @@ import logger from '../index';
describe('formatters', () => {
it('path', () => {
// cSpell:ignore mhey
expect(logger.path('hey')).toMatchInlineSnapshot(`"hey"`);
});
it('id', () => {
@ -39,6 +40,7 @@ describe('interpolate', () => {
expect(
logger.interpolate`The package at path=${'packages/docusaurus'} has number=${10} files. name=${'Babel'} is exported here subdue=${'(as a preset)'} that you can with code=${"require.resolve('@docusaurus/core/lib/babel/preset')"}`,
).toMatchInlineSnapshot(
// cSpell:ignore mpackages
`"The package at packages/docusaurus has 10 files. Babel is exported here (as a preset) that you can with \`require.resolve('@docusaurus/core/lib/babel/preset')\`"`,
);
});

View file

@ -199,7 +199,9 @@ describe('headings remark plugin', () => {
const expected = u('root', [
heading('I ♥ unicode', 'i--unicode'),
heading('Dash-dash', 'dash-dash'),
// cSpell:ignore endash
heading('endash', 'endash'),
// cSpell:ignore emdash
heading('emdash', 'emdash'),
heading('😄 unicode emoji', '-unicode-emoji'),
heading('😄-😄 unicode emoji', '--unicode-emoji'),
@ -214,6 +216,7 @@ describe('headings remark plugin', () => {
heading(':ok_hand: Single', 'ok_hand-single'),
heading(
':ok_hand::hatched_chick: Two in a row with no spaces',
// cSpell:ignore handhatched
'ok_handhatched_chick-two-in-a-row-with-no-spaces',
),
heading(
@ -251,11 +254,11 @@ describe('headings remark plugin', () => {
## Heading Two {#custom-heading-two}
# With *Bold* {#custom-withbold}
# With *Bold* {#custom-with-bold}
# With *Bold* hello{#custom-withbold-hello}
# With *Bold* hello{#custom-with-bold-hello}
# With *Bold* hello2 {#custom-withbold-hello2}
# With *Bold* hello2 {#custom-with-bold-hello2}
# Snake-cased ID {#this_is_custom_id}
@ -281,15 +284,15 @@ describe('headings remark plugin', () => {
text: 'Heading Two',
},
{
id: 'custom-withbold',
id: 'custom-with-bold',
text: 'With Bold',
},
{
id: 'custom-withbold-hello',
id: 'custom-with-bold-hello',
text: 'With Bold hello',
},
{
id: 'custom-withbold-hello2',
id: 'custom-with-bold-hello2',
text: 'With Bold hello2',
},
{

View file

@ -40,4 +40,4 @@
[json](./data.json)
[static json](/staticjson.json)
[static json](/static-json.json)

View file

@ -52,6 +52,6 @@ exports[`transformAsset plugin transform md links to <a /> 1`] = `
<a target=\\"_blank\\" href={require('./data.raw!=!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./data.json').default}>json</a>
<a target=\\"_blank\\" href={require('./static/staticjson.raw!=!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticjson.json').default}>static json</a>
<a target=\\"_blank\\" href={require('./static/static-json.raw!=!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/static-json.json').default}>static json</a>
"
`;

View file

@ -13,6 +13,7 @@ describe('shouldQuotifyFrontMatter', () => {
expect(
shouldQuotifyFrontMatter([
'title',
// cSpell:ignore sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ
"Some title front matter with allowed special chars like sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ!;,=+-_?'`&#()[]§%€$",
]),
).toBe(false);

View file

@ -8,4 +8,4 @@ exports[`validateRedirect throw for bad redirects 3`] = `"{\\"from\\":\\"/fromSo
exports[`validateRedirect throw for bad redirects 4`] = `"{\\"from\\":null,\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: \\"from\\" must be a string"`;
exports[`validateRedirect throw for bad redirects 5`] = `"{\\"from\\":[\\"heyho\\"],\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: \\"from\\" must be a string"`;
exports[`validateRedirect throw for bad redirects 5`] = `"{\\"from\\":[\\"hey\\"],\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: \\"from\\" must be a string"`;

View file

@ -226,7 +226,7 @@ describe('collectRedirects', () => {
`${removeTrailingSlash(routePath)}/some/other/path/suffix2`,
],
},
['/', '/testpath', '/otherPath.html'],
['/', '/testPath', '/otherPath.html'],
),
undefined,
),
@ -241,12 +241,12 @@ describe('collectRedirects', () => {
},
{
from: '/testpath/some/path/suffix1',
to: '/testpath',
from: '/testPath/some/path/suffix1',
to: '/testPath',
},
{
from: '/testpath/some/other/path/suffix2',
to: '/testpath',
from: '/testPath/some/other/path/suffix2',
to: '/testPath',
},
{
@ -272,7 +272,7 @@ describe('collectRedirects', () => {
return undefined;
},
},
['/', '/testpath', '/otherPath.html'],
['/', '/testPath', '/otherPath.html'],
),
undefined,
),

View file

@ -60,7 +60,7 @@ describe('validateRedirect', () => {
expect(() =>
validateRedirect({
from: ['heyho'] as unknown as string,
from: ['hey'] as unknown as string,
to: '/toSomePath?queryString=xyz',
}),
).toThrowErrorMatchingSnapshot();

View file

@ -15,7 +15,7 @@ function testField(params: {
fieldName: keyof BlogPostFrontMatter;
validFrontMatters: BlogPostFrontMatter[];
convertibleFrontMatter?: [
ConvertableFrontMatter: Record<string, unknown>,
ConvertibleFrontMatter: Record<string, unknown>,
ConvertedFrontMatter: BlogPostFrontMatter,
][];
invalidFrontMatters?: [

View file

@ -76,9 +76,9 @@ describe('truncate', () => {
expect(
truncate('aaa\n<!-- truncate -->\nbbb\n ccc', /<!-- truncate -->/),
).toBe('aaa\n');
expect(truncate('\n<!-- truncate -->\nbbb\nccc', /<!-- truncate -->/)).toBe(
'\n',
);
expect(
truncate('\n<!-- truncate -->\nbbb\n ccc', /<!-- truncate -->/),
).toBe('\n');
});
it('leaves texts without markers', () => {
@ -165,12 +165,12 @@ describe('parseBlogFileName', () => {
it('parses nested folder tree respecting date convention', () => {
expect(
parseBlogFileName(
'2021/05/12/announcing-docusaurus-two-beta/subfolder/subfile.md',
'2021/05/12/announcing-docusaurus-two-beta/subfolder/file.md',
),
).toEqual({
date: new Date('2021-05-12Z'),
text: 'announcing-docusaurus-two-beta/subfolder/subfile',
slug: '/2021/05/12/announcing-docusaurus-two-beta/subfolder/subfile',
text: 'announcing-docusaurus-two-beta/subfolder/file',
slug: '/2021/05/12/announcing-docusaurus-two-beta/subfolder/file',
});
});

View file

@ -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

View file

@ -1,7 +1,7 @@
{
"docs": {
"Test": [
"goku"
"nonExistent"
]
}
}

View file

@ -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

View file

@ -13,7 +13,7 @@ function testField(params: {
prefix: string;
validFrontMatters: DocFrontMatter[];
convertibleFrontMatter?: [
ConvertableFrontMatter: Record<string, unknown>,
ConvertibleFrontMatter: Record<string, unknown>,
ConvertedFrontMatter: DocFrontMatter,
][];
invalidFrontMatters?: [

View file

@ -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."`,
);
});
});

View file

@ -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."`,
);
});
});

View file

@ -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',
}),

View file

@ -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 () => {

View file

@ -49,9 +49,9 @@ Array [
],
"label": "SubGuides (metadata file label)",
"link": Object {
"description": "subguides-description",
"slug": "subguides-generated-index-slug",
"title": "subguides-title",
"description": "subGuides-description",
"slug": "subGuides-generated-index-slug",
"title": "subGuides-title",
"type": "generated-index",
},
"type": "category",

View file

@ -131,9 +131,9 @@ describe('DefaultSidebarItemsGenerator', () => {
label: 'SubGuides (metadata file label)',
link: {
type: 'generated-index',
slug: 'subguides-generated-index-slug',
title: 'subguides-title',
description: 'subguides-description',
slug: 'subGuides-generated-index-slug',
title: 'subGuides-title',
description: 'subGuides-description',
},
},
},

View file

@ -43,7 +43,7 @@ describe('loadSidebars', () => {
expect(result).toMatchSnapshot();
});
it('sidebars shorthand and longform lead to exact same sidebar', async () => {
it('sidebars shorthand and longhand lead to exact same sidebar', async () => {
const sidebarPath1 = path.join(fixtureDir, 'sidebars-category.js');
const sidebarPath2 = path.join(
fixtureDir,
@ -81,8 +81,8 @@ describe('loadSidebars', () => {
expect(result).toMatchSnapshot();
});
it('unexisting path', async () => {
await expect(loadSidebars('badpath', params)).resolves.toEqual(
it('nonexistent path', async () => {
await expect(loadSidebars('bad/path', params)).resolves.toEqual(
DisabledSidebars,
);
});

View file

@ -83,6 +83,7 @@ describe('normalization', () => {
sidebar: 'item',
}),
).toThrowErrorMatchingInlineSnapshot(
// cSpell:ignore msidebar
`"Invalid sidebar items collection \`\\"item\\"\` in sidebar sidebar: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a \`type\` property). See https://docusaurus.io/docs/sidebar/items for all valid syntaxes."`,
);
});

View file

@ -38,7 +38,7 @@ describe('createSitemap', () => {
{
url: 'https://example.com',
} as DocusaurusConfig,
['/', '/404.html', '/mypage'],
['/', '/404.html', '/my-page'],
{
changefreq: EnumChangefreq.DAILY,
priority: 0.7,

View file

@ -24,7 +24,7 @@ import TabItem from '@theme/TabItem';
"
`;
exports[`npm2yarn plugin tdoes not re-import tabs components when already imported below 1`] = `
exports[`npm2yarn plugin does not re-import tabs components when already imported below 1`] = `
"<Tabs>
<TabItem value=\\"npm\\">

View file

@ -49,7 +49,7 @@ describe('npm2yarn plugin', () => {
expect(result).toMatchSnapshot();
});
it('tdoes not re-import tabs components when already imported below', async () => {
it('does not re-import tabs components when already imported below', async () => {
const result = await processFixture('import-tabs-below');
expect(result).toMatchSnapshot();

View file

@ -38,7 +38,7 @@ describe('themeConfig', () => {
additionalLanguages: ['kotlin', 'java'],
},
announcementBar: {
id: 'supportus',
id: 'supports',
content: 'pls support',
backgroundColor: '#fff',
textColor: '#000',
@ -206,7 +206,7 @@ describe('themeConfig', () => {
{
type: 'joke',
position: 'left',
label: 'haha',
label: 'hahaha',
},
],
},

View file

@ -3,7 +3,7 @@
exports[`parseLines does not parse content with metastring 1`] = `
Object {
"code": "aaaaa
bbbbb",
nnnnn",
"highlightLines": Array [
0,
],

View file

@ -68,7 +68,7 @@ describe('parseLanguage', () => {
describe('parseLines', () => {
it('does not parse content with metastring', () => {
expect(parseLines('aaaaa\nbbbbb', '{1}', 'js')).toMatchSnapshot();
expect(parseLines('aaaaa\nnnnnn', '{1}', 'js')).toMatchSnapshot();
expect(
parseLines(
`// highlight-next-line

View file

@ -270,7 +270,7 @@ describe('isActiveSidebarItem', () => {
label: 'Label',
};
expect(isActiveSidebarItem(item, '/unexistingPath')).toBe(false);
expect(isActiveSidebarItem(item, '/nonexistentPath')).toBe(false);
expect(isActiveSidebarItem(item, '/itemPath')).toBe(true);
@ -286,7 +286,7 @@ describe('isActiveSidebarItem', () => {
href: '/itemPath',
});
expect(isActiveSidebarItem(item, '/unexistingPath')).toBe(false);
expect(isActiveSidebarItem(item, '/nonexistentPath')).toBe(false);
expect(isActiveSidebarItem(item, '/itemPath')).toBe(true);
@ -319,7 +319,7 @@ describe('isActiveSidebarItem', () => {
],
});
expect(isActiveSidebarItem(item, '/unexistingPath')).toBe(false);
expect(isActiveSidebarItem(item, '/nonexistentPath')).toBe(false);
expect(isActiveSidebarItem(item, '/category-path')).toBe(true);
expect(isActiveSidebarItem(item, '/sub-link-path')).toBe(true);

View file

@ -13,9 +13,10 @@ describe('isRegexpStringMatch', () => {
expect(isRegexpStringMatch('bar', undefined)).toBe(false);
expect(isRegexpStringMatch('foo', 'bar')).toBe(false);
expect(isRegexpStringMatch('foo', 'foo')).toBe(true);
// cSpell:ignore fooooooooooo
expect(isRegexpStringMatch('fooooooooooo', 'foo')).toBe(false);
expect(isRegexpStringMatch('foo', 'fooooooo')).toBe(true);
expect(isRegexpStringMatch('f.*o', 'fggo')).toBe(true);
expect(isRegexpStringMatch('foo', 'fooooooooooo')).toBe(true);
expect(isRegexpStringMatch('f.*o', 'fooooooooooo')).toBe(true);
expect(isRegexpStringMatch('FOO', 'foo')).toBe(true);
});
});

View file

@ -24,7 +24,7 @@ describe('listTagsByLetters', () => {
permalink: '/tag2',
count: 11,
};
const tagzxy: Tag = {
const tagZxy: Tag = {
name: 'zxy',
permalink: '/zxy',
count: 987,
@ -34,34 +34,34 @@ describe('listTagsByLetters', () => {
permalink: '/abc',
count: 123,
};
const tagdef: Tag = {
const tagDef: Tag = {
name: 'def',
permalink: '/def',
count: 1,
};
const tagaaa: Tag = {
const tagAaa: Tag = {
name: 'aaa',
permalink: '/aaa',
count: 10,
};
const expectedResult: Result = [
{letter: 'A', tags: [tagaaa, tagAbc]},
{letter: 'D', tags: [tagdef]},
{letter: 'A', tags: [tagAaa, tagAbc]},
{letter: 'D', tags: [tagDef]},
{letter: 'T', tags: [tag1, tag2]},
{letter: 'Z', tags: [tagzxy]},
{letter: 'Z', tags: [tagZxy]},
];
// Input order shouldn't matter, output is always consistently sorted
expect(
listTagsByLetters([tag1, tag2, tagzxy, tagAbc, tagdef, tagaaa]),
listTagsByLetters([tag1, tag2, tagZxy, tagAbc, tagDef, tagAaa]),
).toEqual(expectedResult);
expect(
listTagsByLetters([tagzxy, tagdef, tagaaa, tag2, tagAbc, tag1]),
listTagsByLetters([tagZxy, tagDef, tagAaa, tag2, tagAbc, tag1]),
).toEqual(expectedResult);
expect(
listTagsByLetters(
_.shuffle([tagzxy, tagdef, tagaaa, tag2, tagAbc, tag1]),
_.shuffle([tagZxy, tagDef, tagAaa, tag2, tagAbc, tag1]),
),
).toEqual(expectedResult);
});

View file

@ -31,7 +31,7 @@ describe('validateThemeConfig', () => {
});
});
it('unexist config', () => {
it('nonexistent config', () => {
expect(testValidateThemeConfig({})).toEqual({
liveCodeBlock: {
...DEFAULT_CONFIG,

View file

@ -67,7 +67,7 @@ describe('readDefaultCodeTranslationMessages', () => {
);
});
it('for unexisting locale', async () => {
it('for nonexistent locale', async () => {
await expect(
readDefaultCodeTranslationMessages({
locale: 'es',

View file

@ -172,7 +172,7 @@ describe('findFolderContainingFile', () => {
it('find appropriate folder', async () => {
await expect(
findFolderContainingFile(
['/abcdef', '/gehij', __dirname, '/klmn'],
['/foo', '/baz', __dirname, '/bar'],
'dataFileUtils.test.ts',
),
).resolves.toEqual(__dirname);
@ -180,7 +180,7 @@ describe('findFolderContainingFile', () => {
it('return undefined if no folder contain such file', async () => {
await expect(
findFolderContainingFile(['/abcdef', '/gehij', '/klmn'], 'index.test.ts'),
findFolderContainingFile(['/foo', '/bar', '/baz'], 'index.test.ts'),
).resolves.toBeUndefined();
});
});
@ -189,7 +189,7 @@ describe('getFolderContainingFile', () => {
it('get appropriate folder', async () => {
await expect(
getFolderContainingFile(
['/abcdef', '/gehij', __dirname, '/klmn'],
['/foo', '/baz', __dirname, '/bar'],
'dataFileUtils.test.ts',
),
).resolves.toEqual(__dirname);
@ -198,14 +198,14 @@ describe('getFolderContainingFile', () => {
it('throw if no folder contain such file', async () => {
await expect(
getFolderContainingFile(
['/abcdef', '/gehij', '/klmn'],
['/foo', '/bar', '/baz'],
'dataFileUtils.test.ts',
),
).rejects.toThrowErrorMatchingInlineSnapshot(`
"File \\"dataFileUtils.test.ts\\" does not exist in any of these folders:
- /abcdef
- /gehij
- /klmn]"
- /foo
- /bar
- /baz"
`);
});
});

View file

@ -83,7 +83,7 @@ describe('getPluginI18nPath', () => {
}).replace(__dirname, ''),
).toMatchInlineSnapshot(`"/i18n/zh-Hans/plugin-content-docs/foo"`);
});
it('gets correct path when no subpaths', () => {
it('gets correct path when no sub-paths', () => {
expect(
getPluginI18nPath({
siteDir: __dirname,

View file

@ -34,7 +34,7 @@ describe('removePrefix', () => {
expect(removePrefix('abcdef', '')).toBe('abcdef');
});
it('removes prefix', () => {
expect(removePrefix('abcdef', 'ab')).toBe('cdef');
expect(removePrefix('prefix', 'pre')).toBe('fix');
});
});

View file

@ -116,7 +116,7 @@ describe('createExcerpt', () => {
export function ItemCol(props) { return <Item {...props} className={'col col--6 margin-bottom--lg'}/> };
Lorem **ipsum** dolor sit \`amet\`[^1], consectetur _adipiscing_ elit. [**Vestibulum**](https://wiktionary.org/wiki/vestibulum) ex urna[^bignote], ~~molestie~~ et sagittis ut, varius ac justo :wink:.
Lorem **ipsum** dolor sit \`amet\`[^1], consectetur _adipiscing_ elit. [**Vestibulum**](https://wiktionary.org/wiki/vestibulum) ex urna[^note], ~~molestie~~ et sagittis ut, varius ac justo :wink:.
Nunc porttitor libero nec vulputate venenatis. Nam nec rhoncus mauris. Morbi tempus est et nibh maximus, tempus venenatis arcu lobortis.
`),

View file

@ -10,6 +10,7 @@ import {createSlugger} from '../slugger';
describe('createSlugger', () => {
it('can create unique slugs', () => {
const slugger = createSlugger();
// cSpell:ignore somevalue
expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue');
expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue-1');
expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue-2');

View file

@ -243,6 +243,7 @@ describe('resolvePathname', () => {
describe('encodePath', () => {
it('works', () => {
expect(encodePath('a/foo/')).toBe('a/foo/');
// cSpell:ignore cfoo
expect(encodePath('a/<foo>/')).toBe('a/%3Cfoo%3E/');
expect(encodePath('a/你好/')).toBe('a/%E4%BD%A0%E5%A5%BD/');
});

View file

@ -83,7 +83,7 @@ export async function getFolderContainingFile(
throw new Error(
`File "${relativeFilePath}" does not exist in any of these folders:\n- ${folderPaths.join(
'\n- ',
)}]`,
)}`,
);
}
return maybeFolderPath;

View file

@ -34,18 +34,18 @@ describe('useBaseUrl', () => {
expect(mockUseBaseUrl('/hello')).toBe('/hello');
expect(mockUseBaseUrl('hello/')).toBe('/hello/');
expect(mockUseBaseUrl('/hello/')).toBe('/hello/');
expect(mockUseBaseUrl('hello/byebye')).toBe('/hello/byebye');
expect(mockUseBaseUrl('/hello/byebye')).toBe('/hello/byebye');
expect(mockUseBaseUrl('hello/byebye/')).toBe('/hello/byebye/');
expect(mockUseBaseUrl('/hello/byebye/')).toBe('/hello/byebye/');
expect(mockUseBaseUrl('hello/foo')).toBe('/hello/foo');
expect(mockUseBaseUrl('/hello/foo')).toBe('/hello/foo');
expect(mockUseBaseUrl('hello/foo/')).toBe('/hello/foo/');
expect(mockUseBaseUrl('/hello/foo/')).toBe('/hello/foo/');
expect(mockUseBaseUrl('https://github.com')).toBe('https://github.com');
expect(mockUseBaseUrl('//reactjs.org')).toBe('//reactjs.org');
expect(mockUseBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org');
expect(mockUseBaseUrl('https://site.com', forcePrepend)).toBe(
'https://site.com',
);
expect(mockUseBaseUrl('/hello/byebye', {absolute: true})).toBe(
'https://docusaurus.io/hello/byebye',
expect(mockUseBaseUrl('/hello/foo', {absolute: true})).toBe(
'https://docusaurus.io/hello/foo',
);
expect(mockUseBaseUrl('#hello')).toBe('#hello');
});
@ -63,10 +63,10 @@ describe('useBaseUrl', () => {
expect(mockUseBaseUrl('/hello')).toBe('/docusaurus/hello');
expect(mockUseBaseUrl('hello/')).toBe('/docusaurus/hello/');
expect(mockUseBaseUrl('/hello/')).toBe('/docusaurus/hello/');
expect(mockUseBaseUrl('hello/byebye')).toBe('/docusaurus/hello/byebye');
expect(mockUseBaseUrl('/hello/byebye')).toBe('/docusaurus/hello/byebye');
expect(mockUseBaseUrl('hello/byebye/')).toBe('/docusaurus/hello/byebye/');
expect(mockUseBaseUrl('/hello/byebye/')).toBe('/docusaurus/hello/byebye/');
expect(mockUseBaseUrl('hello/foo')).toBe('/docusaurus/hello/foo');
expect(mockUseBaseUrl('/hello/foo')).toBe('/docusaurus/hello/foo');
expect(mockUseBaseUrl('hello/foo/')).toBe('/docusaurus/hello/foo/');
expect(mockUseBaseUrl('/hello/foo/')).toBe('/docusaurus/hello/foo/');
expect(mockUseBaseUrl('https://github.com')).toBe('https://github.com');
expect(mockUseBaseUrl('//reactjs.org')).toBe('//reactjs.org');
expect(mockUseBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org');
@ -74,8 +74,8 @@ describe('useBaseUrl', () => {
expect(mockUseBaseUrl('https://site.com', forcePrepend)).toBe(
'https://site.com',
);
expect(mockUseBaseUrl('/hello/byebye', {absolute: true})).toBe(
'https://docusaurus.io/docusaurus/hello/byebye',
expect(mockUseBaseUrl('/hello/foo', {absolute: true})).toBe(
'https://docusaurus.io/docusaurus/hello/foo',
);
expect(mockUseBaseUrl('/docusaurus/')).toBe('/docusaurus/');
expect(mockUseBaseUrl('/docusaurus/hello')).toBe('/docusaurus/hello');
@ -102,18 +102,18 @@ describe('useBaseUrlUtils().withBaseUrl()', () => {
expect(withBaseUrl('/hello')).toBe('/hello');
expect(withBaseUrl('hello/')).toBe('/hello/');
expect(withBaseUrl('/hello/')).toBe('/hello/');
expect(withBaseUrl('hello/byebye')).toBe('/hello/byebye');
expect(withBaseUrl('/hello/byebye')).toBe('/hello/byebye');
expect(withBaseUrl('hello/byebye/')).toBe('/hello/byebye/');
expect(withBaseUrl('/hello/byebye/')).toBe('/hello/byebye/');
expect(withBaseUrl('hello/foo')).toBe('/hello/foo');
expect(withBaseUrl('/hello/foo')).toBe('/hello/foo');
expect(withBaseUrl('hello/foo/')).toBe('/hello/foo/');
expect(withBaseUrl('/hello/foo/')).toBe('/hello/foo/');
expect(withBaseUrl('https://github.com')).toBe('https://github.com');
expect(withBaseUrl('//reactjs.org')).toBe('//reactjs.org');
expect(withBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org');
expect(withBaseUrl('https://site.com', forcePrepend)).toBe(
'https://site.com',
);
expect(withBaseUrl('/hello/byebye', {absolute: true})).toBe(
'https://docusaurus.io/hello/byebye',
expect(withBaseUrl('/hello/foo', {absolute: true})).toBe(
'https://docusaurus.io/hello/foo',
);
expect(withBaseUrl('#hello')).toBe('#hello');
});
@ -130,18 +130,18 @@ describe('useBaseUrlUtils().withBaseUrl()', () => {
expect(withBaseUrl('/hello')).toBe('/docusaurus/hello');
expect(withBaseUrl('hello/')).toBe('/docusaurus/hello/');
expect(withBaseUrl('/hello/')).toBe('/docusaurus/hello/');
expect(withBaseUrl('hello/byebye')).toBe('/docusaurus/hello/byebye');
expect(withBaseUrl('/hello/byebye')).toBe('/docusaurus/hello/byebye');
expect(withBaseUrl('hello/byebye/')).toBe('/docusaurus/hello/byebye/');
expect(withBaseUrl('/hello/byebye/')).toBe('/docusaurus/hello/byebye/');
expect(withBaseUrl('hello/foo')).toBe('/docusaurus/hello/foo');
expect(withBaseUrl('/hello/foo')).toBe('/docusaurus/hello/foo');
expect(withBaseUrl('hello/foo/')).toBe('/docusaurus/hello/foo/');
expect(withBaseUrl('/hello/foo/')).toBe('/docusaurus/hello/foo/');
expect(withBaseUrl('https://github.com')).toBe('https://github.com');
expect(withBaseUrl('//reactjs.org')).toBe('//reactjs.org');
expect(withBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org');
expect(withBaseUrl('https://site.com', forcePrepend)).toBe(
'https://site.com',
);
expect(withBaseUrl('/hello/byebye', {absolute: true})).toBe(
'https://docusaurus.io/docusaurus/hello/byebye',
expect(withBaseUrl('/hello/foo', {absolute: true})).toBe(
'https://docusaurus.io/docusaurus/hello/foo',
);
expect(withBaseUrl('/docusaurus/')).toBe('/docusaurus/');
expect(withBaseUrl('/docusaurus/hello')).toBe('/docusaurus/hello');

View file

@ -30,6 +30,7 @@ describe('transformMarkdownContent', () => {
it('can slugify complex headings', () => {
const input = '## abc [Hello] How are you %Sébastien_-_$)( ## -56756';
expect(transformMarkdownContent(input)).toBe(
// cSpell:ignore ébastien
`${input} {#abc-hello-how-are-you-sébastien_-_---56756}`,
);
});

View file

@ -19,5 +19,5 @@ export const Components = {
};
export async function createTempSiteDir(): Promise<string> {
return fs.mkdtemp(path.join(os.tmpdir(), 'docusaurus-test-swizzle-sitedir'));
return fs.mkdtemp(path.join(os.tmpdir(), 'docusaurus-test-swizzle-siteDir'));
}

View file

@ -6,11 +6,11 @@
*/
module.exports = {
title: 'Sakura',
title: 'Site',
tagline: 'This is not an ordinary site',
organizationName: 'endiliey',
projectName: 'sakura',
baseUrl: '/sakura/',
projectName: 'site',
baseUrl: '/site/',
url: 'https://docusaurus.io',
favicon: 'img/docusaurus.ico',
plugins: [

View file

@ -61,6 +61,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 "fooHTMLoo" and so on.
\*[HTML]: Hyper Text Markup Language

View file

@ -58,6 +58,7 @@ describe('handleBrokenLinks', () => {
// bad - non-existent file with spaces in name
'./some%20other%20non-existent%20doc1',
// evil - trying to use ../../ but '/' won't get decoded
// cSpell:ignore Fout
'./break%2F..%2F..%2Fout2',
],
'/docs/goodDoc': [

View file

@ -86,7 +86,7 @@ describe('normalizeConfig', () => {
it('throws error for baseUrl without trailing `/`', () => {
expect(() => {
normalizeConfig({
baseUrl: 'noslash',
baseUrl: 'noSlash',
});
}).toThrowErrorMatchingSnapshot();
});

View file

@ -28,51 +28,51 @@ function loadI18nTest(i18nConfig: I18nConfig, locale?: string) {
}
describe('defaultLocaleConfig', () => {
const canComputeLabel = typeof Intl.DisplayNames !== 'undefined';
it('returns correct labels', () => {
expect(getDefaultLocaleConfig('fr')).toEqual({
label: canComputeLabel ? 'Français' : 'fr',
label: 'Français',
direction: 'ltr',
htmlLang: 'fr',
});
expect(getDefaultLocaleConfig('fr-FR')).toEqual({
label: canComputeLabel ? 'Français (France)' : 'fr-FR',
label: 'Français (France)',
direction: 'ltr',
htmlLang: 'fr-FR',
});
expect(getDefaultLocaleConfig('en')).toEqual({
label: canComputeLabel ? 'English' : 'en',
label: 'English',
direction: 'ltr',
htmlLang: 'en',
});
expect(getDefaultLocaleConfig('en-US')).toEqual({
label: canComputeLabel ? 'American English' : 'en-US',
label: 'American English',
direction: 'ltr',
htmlLang: 'en-US',
});
expect(getDefaultLocaleConfig('zh')).toEqual({
label: canComputeLabel ? '中文' : 'zh',
label: '中文',
direction: 'ltr',
htmlLang: 'zh',
});
expect(getDefaultLocaleConfig('zh-CN')).toEqual({
label: canComputeLabel ? '中文(中国)' : 'zh-CN',
label: '中文(中国)',
direction: 'ltr',
htmlLang: 'zh-CN',
});
expect(getDefaultLocaleConfig('en-US')).toEqual({
label: canComputeLabel ? 'American English' : 'en-US',
label: 'American English',
direction: 'ltr',
htmlLang: 'en-US',
});
expect(getDefaultLocaleConfig('fa')).toEqual({
label: canComputeLabel ? 'فارسی' : 'fa',
// cSpell:ignore فارسی
label: 'فارسی',
direction: 'rtl',
htmlLang: 'fa',
});
expect(getDefaultLocaleConfig('fa-IR')).toEqual({
label: canComputeLabel ? 'فارسی (ایران)' : 'fa-IR',
// cSpell:ignore ایران فارسیا
label: 'فارسی (ایران)',
direction: 'rtl',
htmlLang: 'fa-IR',
});
@ -127,7 +127,7 @@ describe('loadI18n', () => {
});
});
it('loads I18n for multi-locale config with some xcustom locale configs', async () => {
it('loads I18n for multi-locale config with some custom locale configs', async () => {
await expect(
loadI18nTest(
{

View file

@ -108,9 +108,9 @@ describe('htmlTagObjectToString', () => {
it('invalid html tag object', () => {
expect(() =>
htmlTagObjectToString('fooofofoofo'),
htmlTagObjectToString('foo'),
).toThrowErrorMatchingInlineSnapshot(
`"\\"fooofofoofo\\" is not a valid HTML tag object."`,
`"\\"foo\\" is not a valid HTML tag object."`,
);
expect(() =>

View file

@ -621,7 +621,7 @@ export default function MyComponent() {
);
// This one should not be found! On purpose!
const plugin1File3 = path.join(plugin1Dir, 'unscannedFolder', 'file3.jsx');
const plugin1File3 = path.join(plugin1Dir, 'ignoredFolder', 'file3.jsx');
await fs.outputFile(
plugin1File3,
`

View file

@ -60,7 +60,7 @@ describe('babel transpilation exclude logic', () => {
'/website/node_modules/react-trend/index.js',
'/docusaurus/website/node_modules/react-super.js',
'/docusaurus/website/node_modules/@docusaurus/core/node_modules/core-js/modules/_descriptors.js',
'node_modules/docusaurus-theme-classic/node_modules/react-daypicker/index.js',
'node_modules/docusaurus-theme-classic/node_modules/react-slick/index.js',
];
moduleFiles.forEach((file) => {
expect(excludeJS(file)).toBe(true);

View file

@ -5,6 +5,7 @@ alexey
algoliasearch
anonymized
anshul
août
apfs
apos
appinstalled
@ -12,6 +13,7 @@ applanga
architecting
astro
atrule
autoconverted
autogen
autogenerating
backport
@ -39,8 +41,8 @@ cheng
clément
clsx
codeql
codespaces
codesandbox
codespaces
contravariance
corejs
crawlable
@ -50,10 +52,12 @@ customizability
daishi
datagit
datas
décembre
dedup
deduplicated
déja
deps
devspace
devto
dmitry
docgen
@ -65,6 +69,7 @@ docz
doesn
dogfood
dogfooding
dojocat
dyte
easyops
endi
@ -78,6 +83,7 @@ evaluable
externalwaiting
failfast
fbid
février
fienny
flac
formik
@ -91,7 +97,9 @@ globby
goss
goyal
gtag
hahaha
héctor
héllô
heuristical
hideable
hola
@ -107,8 +115,10 @@ intelli
interpolatable
jakepartusch
jamstack
janvier
javadoc
jmarcey
joshcena
jscodeshift
jssdk
kaszubowski
@ -184,6 +194,7 @@ peaceiris
philpl
photoshop
picocolors
picomatch
pluggable
plushie
pnpm
@ -214,6 +225,7 @@ quddus
quddús
quotify
ramón
reactjs
rearchitecture
recrawl
redirections
@ -241,30 +253,38 @@ setaf
sida
simen
slorber
spâce
stackblitz
stackblitzrc
strikethrough
strikethroughs
stylelint
stylelintrc
subdir
sublabel
sublicensable
sublist
subsubsection
subpage
subroute
subroutes
subsetting
subsubcategory
subsubfolder
subsubsection
subsubsubfolder
sucipto
supabase
svgr
swizzlable
teik
templating
thanos
toolset
toplevel
transifex
transpiles
treeified
treeifies
treeify
treosh
triaging
@ -280,6 +300,7 @@ unprefixed
unswizzle
unversioned
upvotes
urlset
userland
vannicatte
vercel

View file

@ -70,6 +70,7 @@ describe('users data', () => {
}),
}).unknown(false),
);
// cSpell:ignore opensource
if (user.tags.includes('opensource') && user.source === null) {
throw new Error(
"You can't add the 'opensource' tag to a site that does not have a link to source code. Please add your source code, or remove this tag.",