mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-27 17:42:16 +00:00
chore: make eslint happy
This commit is contained in:
parent
3298b29dbf
commit
880a3c67fe
@ -2,5 +2,5 @@ import { render, screen } from '@testing-library/react';
|
|||||||
|
|
||||||
test('hello', () => {
|
test('hello', () => {
|
||||||
render(<div>hello</div>);
|
render(<div>hello</div>);
|
||||||
expect(screen.getByText('hello') as any).toBeInTheDocument();
|
expect(screen.getByText('hello')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
@ -3,10 +3,11 @@ import '@testing-library/jest-dom';
|
|||||||
// FIXME: Use something like jsdom-worker?
|
// FIXME: Use something like jsdom-worker?
|
||||||
// see: https://github.com/developit/jsdom-worker
|
// see: https://github.com/developit/jsdom-worker
|
||||||
if (!global.Worker) {
|
if (!global.Worker) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
(global as any).Worker = class MockWorker {
|
(global as any).Worker = class MockWorker {
|
||||||
events: Record<string, (e: unknown) => void> = Object.create(null);
|
events: Record<string, (e: unknown) => void> = Object.create(null);
|
||||||
|
|
||||||
onmessage?: () => {};
|
onmessage = undefined;
|
||||||
addEventListener(name: string, e: unknown) {
|
addEventListener(name: string, e: unknown) {
|
||||||
if (Object.hasOwn(this.events, name)) {
|
if (Object.hasOwn(this.events, name)) {
|
||||||
this.events[name](e);
|
this.events[name](e);
|
||||||
|
@ -6,6 +6,7 @@ import { AppStore, RootState, setupStore } from '~/store';
|
|||||||
|
|
||||||
// Adapted from: https://redux.js.org/usage/writing-tests
|
// Adapted from: https://redux.js.org/usage/writing-tests
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-refresh/only-export-components
|
||||||
export * from '@testing-library/react';
|
export * from '@testing-library/react';
|
||||||
|
|
||||||
export interface ExtendedRenderOptions extends RenderOptions {
|
export interface ExtendedRenderOptions extends RenderOptions {
|
||||||
@ -17,7 +18,7 @@ export function renderWithProviders(
|
|||||||
ui: React.ReactElement,
|
ui: React.ReactElement,
|
||||||
{ preloadedState = {}, store = setupStore(preloadedState), ...renderOptions }: ExtendedRenderOptions = {}
|
{ 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>;
|
return <Provider store={store}>{children}</Provider>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user