mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 22:17:00 +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
|
@ -288,30 +288,30 @@ describe('getAuthorsMap', () => {
|
|||
};
|
||||
|
||||
test('getAuthorsMap can read yml file', async () => {
|
||||
expect(
|
||||
await getAuthorsMap({
|
||||
await expect(
|
||||
getAuthorsMap({
|
||||
contentPaths,
|
||||
authorsMapPath: 'authors.yml',
|
||||
}),
|
||||
).toBeDefined();
|
||||
).resolves.toBeDefined();
|
||||
});
|
||||
|
||||
test('getAuthorsMap can read json file', async () => {
|
||||
expect(
|
||||
await getAuthorsMap({
|
||||
await expect(
|
||||
getAuthorsMap({
|
||||
contentPaths,
|
||||
authorsMapPath: 'authors.json',
|
||||
}),
|
||||
).toBeDefined();
|
||||
).resolves.toBeDefined();
|
||||
});
|
||||
|
||||
test('getAuthorsMap can return undefined if yaml file not found', async () => {
|
||||
expect(
|
||||
await getAuthorsMap({
|
||||
await expect(
|
||||
getAuthorsMap({
|
||||
contentPaths,
|
||||
authorsMapPath: 'authors_does_not_exist.yml',
|
||||
}),
|
||||
).toBeUndefined();
|
||||
).resolves.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ function testField(params: {
|
|||
params.invalidFrontMatters?.forEach(([frontMatter, message]) => {
|
||||
try {
|
||||
validateBlogPostFrontMatter(frontMatter);
|
||||
// eslint-disable-next-line jest/no-jasmine-globals
|
||||
fail(
|
||||
new Error(
|
||||
`Blog frontmatter is expected to be rejected, but was accepted successfully:\n ${JSON.stringify(
|
||||
|
@ -54,6 +55,7 @@ function testField(params: {
|
|||
),
|
||||
);
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(e.message).toMatch(new RegExp(escapeStringRegexp(message)));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue