import './index'; describe('Supplier', () => { describe('Component vnSupplierAddressIndex', () => { let controller; let $scope; let $stateParams; beforeEach(ngModule('supplier')); beforeEach(inject(($componentController, $rootScope, _$stateParams_) => { $stateParams = _$stateParams_; $stateParams.id = 1; $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnSupplierAddressIndex', {$element, $scope}); controller.supplier = {id: 1}; })); describe('exprBuilder()', () => { it('should return a filter based on a search by id', () => { const filter = controller.exprBuilder('search', '123'); expect(filter).toEqual({id: '123'}); }); it('should return a filter based on a search by name', () => { const filter = controller.exprBuilder('search', 'Arkham Chemicals'); expect(filter).toEqual({nickname: {like: '%Arkham Chemicals%'}}); }); }); }); });