import { render, type RenderResult } from '../test-utils';
import { ListItemContext } from './ListItemContext';

export const mockSetControlType = jest.fn();
export const mockSetControlProps = jest.fn();
export const mockSetMediaSize = jest.fn();

export const renderWithListItemContext = (ui: React.ReactNode): RenderResult => {
  return render(
    <ListItemContext.Provider
      value={{
        setControlType: mockSetControlType,
        setControlProps: mockSetControlProps,
        setMediaSize: mockSetMediaSize,
        ids: {
          title: 'title',
          additionalInfo: 'additional-info',
          valueTitle: 'value-title',
          control: 'control',
          prompt: 'prompt',
        },
        props: { disabled: false, inverted: false },
        describedByIds: 'described-by-ids',
      }}
    >
      {ui}
    </ListItemContext.Provider>,
  );
};

export const clearListItemMocks = () => {
  jest.clearAllMocks();
};
