import 'reflect-metadata'; import { RadioButtonComponent, } from './radio-button.component'; const initRadioButtonComponent = () => new RadioButtonComponent(); describe('selected', () => { test('Calls onSelected with isOn value', () => { const radioButtonComponent = initRadioButtonComponent(); radioButtonComponent.isOn = false; radioButtonComponent.onSelected.emit = jest.fn(); radioButtonComponent.selected(); expect(radioButtonComponent.onSelected.emit) .toHaveBeenCalled(); }, ); test('Does not call onSelected, if radio button is not selected', () => { const radioButtonComponent = initRadioButtonComponent(); radioButtonComponent.isOn = true; radioButtonComponent.onSelected.emit = jest.fn(); radioButtonComponent.selected(); expect(radioButtonComponent.onSelected.emit) .not.toHaveBeenCalled(); }, ); });