34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
import './index.js';
|
|
|
|
describe('Travel Component vnTravelIndex', () => {
|
|
let $componentController;
|
|
let controller;
|
|
|
|
beforeEach(angular.mock.module('travel', $translateProvider => {
|
|
$translateProvider.translations('en', {});
|
|
}));
|
|
|
|
beforeEach(angular.mock.inject(_$componentController_ => {
|
|
$componentController = _$componentController_;
|
|
controller = $componentController('vnTravelIndex');
|
|
}));
|
|
|
|
describe('exprBuilder()', () => {
|
|
it('should return a formated object with the travel id in case of search', () => {
|
|
let param = 'search';
|
|
let value = 2;
|
|
let result = controller.exprBuilder(param, value);
|
|
|
|
expect(result).toEqual({id: 2});
|
|
});
|
|
|
|
it('should return a formated object with the warehouseInFk in case of warehouseInFk', () => {
|
|
let param = 'warehouseInFk';
|
|
let value = 3;
|
|
let result = controller.exprBuilder(param, value);
|
|
|
|
expect(result).toEqual({warehouseInFk: 3});
|
|
});
|
|
});
|
|
});
|