salix/modules/supplier/front/address/index/index.spec.js

35 lines
1.2 KiB
JavaScript
Raw Normal View History

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('<vn-supplier-address-index></vn-supplier-address-index>');
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%'}});
});
});
});
});