how to test change event radio button using react testing library

Viewed 14

I tried using fireEvent click, but i get an error like this. enter image description here

my code

            <div className="flex flex-col">
              <DropdownSingle
                label={"Value"}
                dataTestId="select-value"
                value={getValuez}
                onOk={(value: string) =>
                  handleChange(value, "valuez")
                }
                withSearchFilter={false}
                withFooter={false}
                loading={false}
                size={"middle"}
                className={"dropdown-style"}
                defaultValue={valuezOptions[0].id}
                options={valuezOptions}
                optionValueKey={'id'}
                optionLabelKey={'name'}
              />
            </div>
1 Answers
it('changes style of div as checkbox is checked/unchecked', () => {
  const { getByTestId } = render(<MyCheckbox />)
  const checkbox = getByTestId(CHECKBOX_ID)
  const div = getByTestId(DIV_ID)
  expect(checkbox.checked).toEqual(false)
  expect(div.style['display']).toEqual('none')
  fireEvent.click(checkbox)
  expect(checkbox.checked).toEqual(true)
  expect(div.style['display']).toEqual('block')
  fireEvent.click(checkbox)
  expect(checkbox.checked).toEqual(false)
  expect(div.style['display']).toEqual('none')
})

What I am doing here is. let suppose I have a checkbox that is always is visible, checking and unchecking it, causes the dropdown next to it to be shown or hidden.  when I click the checkbox it fires an action that changes the parameter to be either false or true. Mainly I'm trying to test that when I click the checkbox the dropdown is either displayed or not 
Related