Migrated HorizontalBarChart test to react testing library

This commit is contained in:
Alejandro Celaya
2022-05-13 20:18:40 +02:00
parent 4999f982e4
commit 64ee9a39cc
4 changed files with 50 additions and 41 deletions

View 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 };
};