import './index'; describe('client unpaid', () => { describe('Component vnClientUnpaid', () => { let controller; beforeEach(ngModule('client')); beforeEach(inject($componentController => { const $element = angular.element(''); controller = $componentController('vnClientUnpaid', {$element}); })); describe('setDefaultDate()', () => { it(`should not set today date if has dated`, () => { const hasData = true; const yesterday = new Date(); yesterday.setDate(yesterday.getDate() - 1); controller.clientUnpaid = { dated: yesterday }; controller.setDefaultDate(hasData); expect(controller.clientUnpaid.dated).toEqual(yesterday); }); it(`should set today if not has dated`, () => { const hasData = true; controller.clientUnpaid = {}; controller.setDefaultDate(hasData); expect(controller.clientUnpaid.dated).toBeDefined(); }); }); }); });