mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
chore: enable eslint-plugin-jest (#6375)
This commit is contained in:
parent
3e5944ef1f
commit
52db7320a6
32 changed files with 194 additions and 193 deletions
|
@ -41,6 +41,7 @@ function testField(params: {
|
|||
params.invalidFrontMatters?.forEach(([frontMatter, message]) => {
|
||||
try {
|
||||
validateDocFrontMatter(frontMatter);
|
||||
// eslint-disable-next-line jest/no-jasmine-globals
|
||||
fail(
|
||||
new Error(
|
||||
`Doc frontmatter is expected to be rejected, but was accepted successfully:\n ${JSON.stringify(
|
||||
|
@ -51,6 +52,7 @@ function testField(params: {
|
|||
),
|
||||
);
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(e.message).toMatch(new RegExp(escapeStringRegexp(message)));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -52,20 +52,20 @@ describe('lastUpdate', () => {
|
|||
'__fixtures__',
|
||||
nonExistingFileName,
|
||||
);
|
||||
expect(await getFileLastUpdate(nonExistingFilePath)).toBeNull();
|
||||
await expect(getFileLastUpdate(nonExistingFilePath)).resolves.toBeNull();
|
||||
expect(consoleMock).toHaveBeenCalledTimes(1);
|
||||
expect(consoleMock).toHaveBeenLastCalledWith(
|
||||
expect.stringMatching(/with exit code 128/),
|
||||
);
|
||||
expect(await getFileLastUpdate(null)).toBeNull();
|
||||
expect(await getFileLastUpdate(undefined)).toBeNull();
|
||||
await expect(getFileLastUpdate(null)).resolves.toBeNull();
|
||||
await expect(getFileLastUpdate(undefined)).resolves.toBeNull();
|
||||
consoleMock.mockRestore();
|
||||
});
|
||||
|
||||
test('temporary created file that has no git timestamp', async () => {
|
||||
const tempFilePath = path.join(__dirname, '__fixtures__', '.temp');
|
||||
fs.writeFileSync(tempFilePath, 'Lorem ipsum :)');
|
||||
expect(await getFileLastUpdate(tempFilePath)).toBeNull();
|
||||
await expect(getFileLastUpdate(tempFilePath)).resolves.toBeNull();
|
||||
fs.unlinkSync(tempFilePath);
|
||||
});
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ describe('createSidebarsUtils', () => {
|
|||
getFirstLink,
|
||||
} = createSidebarsUtils(sidebars);
|
||||
|
||||
test('getSidebarNameByDocId', async () => {
|
||||
test('getFirstDocIdOfFirstSidebar', async () => {
|
||||
expect(getFirstDocIdOfFirstSidebar()).toEqual('doc1');
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue