import './multi-check.js'; xdescribe('Component vnMultiCheck', () => { let $componentController; let controller; beforeEach(() => { angular.mock.module('client'); }); beforeEach(angular.mock.inject(_$componentController_ => { $componentController = _$componentController_; controller = $componentController('vnMultiCheck', {}); })); describe('checkAll() setter', () => { it(`should set controller _checkAll property with the argument received then call switchChecks()`, () => { let argument = 'I am the model'; spyOn(controller, 'switchChecks'); controller.checkAll = argument; expect(controller._checkAll).toEqual(argument); expect(controller.switchChecks).toHaveBeenCalledWith(); }); }); describe('switchChecks()', () => { it(`should set checked property inside each existing elemenet when id begings with no-`, () => { controller.data = [ {name: 'name'}, {name: null} ]; expect(controller.data[0].checked).not.toBeDefined(); expect(controller.data[1].checked).not.toBeDefined(); controller._checkAll = 1; controller.switchChecks(); expect(controller.data[0].checked).toBeTruthy(); expect(controller.data[1].checked).toBeTruthy(); }); }); });