[TNL-7268] Fix imports, ignore implicit exports for tests
This commit is contained in:
10
.eslintrc.js
10
.eslintrc.js
@@ -1,3 +1,11 @@
|
||||
const { createConfig } = require('@edx/frontend-build');
|
||||
|
||||
module.exports = createConfig('eslint');
|
||||
module.exports = createConfig('eslint', {
|
||||
overrides: [{
|
||||
files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)", "setupTest.js"],
|
||||
rules: {
|
||||
'import/named': 'off',
|
||||
'import/no-extraneous-dependencies': 'off',
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import React from 'react';
|
||||
import { fireEvent, waitFor } from '@testing-library/dom';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
|
||||
import {
|
||||
initialState, loadUnit, render, screen, testUnits,
|
||||
initialState, loadUnit, render, screen, testUnits, fireEvent, waitFor,
|
||||
} from '../../../setupTest';
|
||||
import Sequence from './Sequence';
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import React from 'react';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { waitFor } from '@testing-library/dom';
|
||||
import {
|
||||
initialState, loadUnit, messageEvent, render, screen,
|
||||
initialState, loadUnit, messageEvent, render, screen, waitFor,
|
||||
} from '../../../setupTest';
|
||||
import Unit from './Unit';
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import React from 'react';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { fireEvent, getByText } from '@testing-library/dom';
|
||||
import {
|
||||
initialState, render, screen, testUnits,
|
||||
initialState, render, screen, testUnits, fireEvent, getByText,
|
||||
} from '../../../../setupTest';
|
||||
import SequenceNavigation from './SequenceNavigation';
|
||||
import useIndexOfLastVisibleChild from '../../../../generic/tabs/useIndexOfLastVisibleChild';
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import React from 'react';
|
||||
import { fireEvent } from '@testing-library/dom';
|
||||
import SequenceNavigationDropdown from './SequenceNavigationDropdown';
|
||||
import {
|
||||
initialState, render, screen, testUnits,
|
||||
initialState, render, screen, testUnits, fireEvent,
|
||||
} from '../../../../setupTest';
|
||||
|
||||
describe('Sequence Navigation Dropdown', () => {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import { fireEvent } from '@testing-library/dom';
|
||||
import { render, screen } from '../../../../setupTest';
|
||||
import { render, screen, fireEvent } from '../../../../setupTest';
|
||||
import UnitButton from './UnitButton';
|
||||
|
||||
describe('Unit Button', () => {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { fireEvent } from '@testing-library/dom';
|
||||
import {
|
||||
initialState, render, screen, testUnits,
|
||||
initialState, render, screen, testUnits, fireEvent,
|
||||
} from '../../../../setupTest';
|
||||
import UnitNavigation from './UnitNavigation';
|
||||
|
||||
|
||||
@@ -7,11 +7,9 @@ import { configure as configureLogging } from '@edx/frontend-platform/logging';
|
||||
import { configure as configureAuth, MockAuthService } from '@edx/frontend-platform/auth';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { render as rtlRender, screen } from '@testing-library/react';
|
||||
import { render as rtlRender } from '@testing-library/react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { configureStore } from '@reduxjs/toolkit';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { reducer as courseHomeReducer } from './course-home/data';
|
||||
import { reducer as coursewareReducer } from './courseware/data/slice';
|
||||
@@ -185,11 +183,10 @@ function render(
|
||||
return rtlRender(ui, { wrapper: Wrapper, ...renderOptions });
|
||||
}
|
||||
|
||||
// re-export everything
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// Re-export everything.
|
||||
export * from '@testing-library/react';
|
||||
|
||||
// override `render` method; export `screen` too to suppress errors
|
||||
// Override `render` method; export `screen` too to suppress errors.
|
||||
export {
|
||||
render, screen, testUnits, baseInitialState as initialState, messageEvent, loadUnit,
|
||||
render, testUnits, baseInitialState as initialState, messageEvent, loadUnit,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user