import { act, fireEvent } from '@testing-library/react';
import { render } from '../../utils/theme-render-wrapper';
import BillingOption from './billing-option';
describe('', () => {
it('should render label text', () => {
const text = 'Label';
const { getByTestId } = render();
expect(getByTestId('radioFormWrapper').lastChild?.textContent).toEqual(text);
});
it('should render active style successfully', () => {
const { baseElement } = render();
expect(baseElement).toMatchSnapshot();
});
it('should render active style successfully', () => {
const { baseElement } = render();
expect(baseElement).toMatchSnapshot();
});
it('should render badge text', () => {
const badgeLabel = 'badgeLabel';
const { getByTestId } = render(
);
expect(getByTestId('coloredTextWithBG').textContent).toEqual(badgeLabel);
});
it('should fire a callback with the new state when clicking on radio', () => {
const onClickMock = jest.fn();
const { baseElement, getByTestId } = render(
);
const radioButton = getByTestId('radioFormWrapper');
act(() => {
fireEvent.click(radioButton);
});
expect(onClickMock).toHaveBeenCalled();
});
});