mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-12 09:36:20 +00:00
Migrated HorizontalBarChart test to react testing library
This commit is contained in:
10
test/__mocks__/setUpCanvas.ts
Normal file
10
test/__mocks__/setUpCanvas.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ReactElement } from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
|
||||
export const setUpCanvas = (element: ReactElement) => {
|
||||
const result = render(element);
|
||||
const { container } = result;
|
||||
const events = container.querySelector('canvas')?.getContext('2d')?.__getEvents(); // eslint-disable-line no-underscore-dangle
|
||||
|
||||
return { ...result, events };
|
||||
};
|
||||
Reference in New Issue
Block a user