salix/modules/agency/front/index/index.spec.js

34 lines
1.1 KiB
JavaScript

import './index.js';
describe('Agency Component vnZoneIndex', () => {
let $componentController;
let controller;
beforeEach(angular.mock.module('agency', $translateProvider => {
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(_$componentController_ => {
$componentController = _$componentController_;
controller = $componentController('vnZoneIndex');
}));
describe('exprBuilder()', () => {
it('should return a formated object with the id in case of search', () => {
let param = 'search';
let value = 1;
let result = controller.exprBuilder(param, value);
expect(result).toEqual({id: 1});
});
it('should return a formated object with the warehouseFk in case of agencyModeFk', () => {
let param = 'agencyModeFk';
let value = 'My Delivery';
let result = controller.exprBuilder(param, value);
expect(result).toEqual({agencyModeFk: 'My Delivery'});
});
});
});