import './index.js'; import crudModel from 'core/mocks/crud-model'; fdescribe('Item', () => { describe('Component vnItemWasteIndex', () => { let $scope; let controller; beforeEach(ngModule('item')); beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); $scope.model = crudModel; const $element = angular.element(''); controller = $componentController('vnItemWasteIndex', {$element, $scope}); })); describe('getWasteConfig / setWasteConfig', () => { it('should return the local storage wasteConfig', () => { const result = controller.getWasteConfig(); expect(result).toEqual({}); }); it('should set and return the local storage wasteConfig', () => { controller.wasteConfig = {salesPerson: {hidden: true}}; controller.setWasteConfig(); const result = controller.getWasteConfig(); expect(result).toEqual(controller.wasteConfig); }); }); describe('toggleHidePanel()', () => { it('should make details hidden by default', () => { controller.wasteConfig = {}; controller.toggleHidePanel({buyer: 'salesPerson'}); expect(controller.wasteConfig.salesPerson.hidden).toEqual(true); }); it('should toggle hidden false', () => { controller.wasteConfig = {salesPerson: {hidden: true}}; controller.toggleHidePanel({buyer: 'salesPerson'}); expect(controller.wasteConfig.salesPerson.hidden).toEqual(false); }); }); }); });