chore: make eslint happy

This commit is contained in:
鲁树人 2023-05-18 00:04:20 +01:00
parent 6299302ff9
commit be76a4590f
3 changed files with 5 additions and 3 deletions

View File

@ -2,5 +2,5 @@ import { render, screen } from '@testing-library/react';
test('hello', () => {
render(<div>hello</div>);
expect(screen.getByText('hello') as any).toBeInTheDocument();
expect(screen.getByText('hello')).toBeInTheDocument();
});

View File

@ -3,10 +3,11 @@ import '@testing-library/jest-dom';
// FIXME: Use something like jsdom-worker?
// see: https://github.com/developit/jsdom-worker
if (!global.Worker) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(global as any).Worker = class MockWorker {
events: Record<string, (e: unknown) => void> = Object.create(null);
onmessage?: () => {};
onmessage = undefined;
addEventListener(name: string, e: unknown) {
if (Object.hasOwn(this.events, name)) {
this.events[name](e);

View File

@ -6,6 +6,7 @@ import { AppStore, RootState, setupStore } from '~/store';
// Adapted from: https://redux.js.org/usage/writing-tests
// eslint-disable-next-line react-refresh/only-export-components
export * from '@testing-library/react';
export interface ExtendedRenderOptions extends RenderOptions {
@ -17,7 +18,7 @@ export function renderWithProviders(
ui: React.ReactElement,
{ preloadedState = {}, store = setupStore(preloadedState), ...renderOptions }: ExtendedRenderOptions = {}
) {
function Wrapper({ children }: PropsWithChildren<{}>): JSX.Element {
function Wrapper({ children }: PropsWithChildren<unknown>): JSX.Element {
return <Provider store={store}>{children}</Provider>;
}