mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-05 20:32:42 +02:00
test: enable a few jest eslint rules (#6900)
* test: enable a few jest eslint rules * more
This commit is contained in:
parent
1efc6c6091
commit
aa5a2d4c04
155 changed files with 3644 additions and 3478 deletions
|
@ -7,8 +7,8 @@
|
|||
|
||||
import {shouldQuotifyFrontMatter} from '../frontMatter';
|
||||
|
||||
describe('frontMatter', () => {
|
||||
test('shouldQuotifyFrontMatter', () => {
|
||||
describe('shouldQuotifyFrontMatter', () => {
|
||||
it('works', () => {
|
||||
expect(shouldQuotifyFrontMatter(['id', 'value'])).toEqual(false);
|
||||
expect(
|
||||
shouldQuotifyFrontMatter([
|
||||
|
|
|
@ -12,10 +12,10 @@ import fs from 'fs-extra';
|
|||
import {posixPath} from '@docusaurus/utils';
|
||||
|
||||
async function testMigration(siteDir: string, newDir: string) {
|
||||
const writeMock = jest.spyOn(fs, 'outputFile').mockImplementation();
|
||||
const mkdirpMock = jest.spyOn(fs, 'mkdirp').mockImplementation();
|
||||
const mkdirsMock = jest.spyOn(fs, 'mkdirs').mockImplementation();
|
||||
const copyMock = jest.spyOn(fs, 'copy').mockImplementation();
|
||||
const writeMock = jest.spyOn(fs, 'outputFile').mockImplementation(() => {});
|
||||
const mkdirpMock = jest.spyOn(fs, 'mkdirp').mockImplementation(() => {});
|
||||
const mkdirsMock = jest.spyOn(fs, 'mkdirs').mockImplementation(() => {});
|
||||
const copyMock = jest.spyOn(fs, 'copy').mockImplementation(() => {});
|
||||
await migrateDocusaurusProject(siteDir, newDir, true, true);
|
||||
expect(
|
||||
writeMock.mock.calls.sort((a, b) =>
|
||||
|
@ -45,18 +45,18 @@ async function testMigration(siteDir: string, newDir: string) {
|
|||
|
||||
describe('migration test', () => {
|
||||
const fixtureDir = path.join(__dirname, '__fixtures__');
|
||||
test('simple website', async () => {
|
||||
it('simple website', async () => {
|
||||
const siteDir = path.join(fixtureDir, 'simple_website', 'website');
|
||||
const newDir = path.join(fixtureDir, 'migrated_simple_site');
|
||||
await testMigration(siteDir, newDir);
|
||||
});
|
||||
test('complex website', async () => {
|
||||
it('complex website', async () => {
|
||||
const siteDir = path.join(fixtureDir, 'complex_website', 'website');
|
||||
const newDir = path.join(fixtureDir, 'migrated_complex_site');
|
||||
await testMigration(siteDir, newDir);
|
||||
});
|
||||
|
||||
test('missing versions', async () => {
|
||||
it('missing versions', async () => {
|
||||
const siteDir = path.join(fixtureDir, 'missing_version_website', 'website');
|
||||
const newDir = path.join(fixtureDir, 'migrated_missing_version_site');
|
||||
await testMigration(siteDir, newDir);
|
||||
|
|
|
@ -10,7 +10,7 @@ import {createConfigFile} from '../index';
|
|||
import type {VersionOneConfig} from '../types';
|
||||
|
||||
describe('create config', () => {
|
||||
test('simple test', () => {
|
||||
it('simple test', () => {
|
||||
const v1Config: VersionOneConfig = importFresh(
|
||||
`${__dirname}/__fixtures__/sourceSiteConfig.js`,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue