import 'reflect-metadata'; import { CheckboxComponent, } from './checkbox.component'; const initCheckboxComponent = () => { return new CheckboxComponent(); }; describe('checked', () => { // tslint:disable-next-line test('It sets isChecked to true if isChecked is false', () => { const checkboxComponent = initCheckboxComponent(); checkboxComponent.isChecked = false; checkboxComponent.checked(); expect( checkboxComponent.isChecked, ).toBe(true); }); // tslint:disable-next-line test('It sets isChecked to false if isChecked is true', () => { const checkboxComponent = initCheckboxComponent(); checkboxComponent.isChecked = true; checkboxComponent.checked(); expect( checkboxComponent.isChecked, ).toBe(false); }); // tslint:disable-next-line test('It calls onChecked.emit with the opposite value of isChecked', () => { const checkboxComponent = initCheckboxComponent(); checkboxComponent.isChecked = false; checkboxComponent.onChecked.emit = jest.fn(); checkboxComponent.checked(); expect( checkboxComponent.onChecked.emit, ).toHaveBeenCalledWith(true); }); });