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

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

@ -31,7 +31,7 @@ describe('isNameTooLong', () => {
true,
'foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-test-1-test-2-787':
true,
// Every Hanzi is three bytes
// Every Han zi is three bytes
:
{apfs: false, xfs: true},
};

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;