import React from 'react';
import { cleanup } from '@testing-library/react';
import { render } from '../../utils/theme-render-wrapper';
import { ThemeProvider } from '../@styles/theme-provider';
import type { Theme } from '../@styles/theme-provider';
import { Donut } from '.';
import type { DonutProps } from '.';
declare module '@mui/styles/defaultTheme' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface DefaultTheme extends Theme {}
}
afterEach(cleanup);
const title = '7/10';
const subtitle = 'variants';
const tooltip = true;
const size = 'large';
const half = true;
const postfix = '%';
const donutTest: DonutProps = {
data: [
{
name: 'One',
value: 23,
color: '#4DC9F6'
},
{
name: 'Two',
value: 7,
color: '#FBDF9C'
},
{
name: 'Four',
value: 12
}
]
};
describe('', () => {
it(`Should render successfully`, () => {
const { baseElement } = render(
);
expect(baseElement).toBeTruthy();
});
it(`Should render half donut with tooltip`, () => {
const { baseElement } = render(
);
expect(baseElement).toBeTruthy();
});
it(`Should render xsmall donut with 2 entries`, () => {
const { baseElement } = render(
);
expect(baseElement).toBeTruthy();
});
it(`Should render Donut with all data`, () => {
const { queryByText } = render(
);
let elm = queryByText(title);
expect(elm?.innerHTML).toBe(title);
elm = queryByText(subtitle);
expect(elm?.innerHTML).toBe(subtitle);
});
it(`Should not render Donut title and subtitle`, () => {
const { queryByText } = render(
);
let elm = queryByText(title);
expect(elm?.innerHTML).toBeUndefined();
elm = queryByText(subtitle);
expect(elm?.innerHTML).toBeUndefined();
});
});