#517 ticket index unit tests
This commit is contained in:
parent
90fdb5db84
commit
8fa84c5074
|
@ -14,6 +14,56 @@ describe('ticket', () => {
|
||||||
controller = $componentController('vnTicketIndex');
|
controller = $componentController('vnTicketIndex');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
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 nickname in case of search', () => {
|
||||||
|
let param = 'search';
|
||||||
|
let value = 'Bruce';
|
||||||
|
let result = controller.exprBuilder(param, value);
|
||||||
|
|
||||||
|
expect(result).toEqual({nickname: {regexp: 'Bruce'}});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a formated object with the date in case of from', () => {
|
||||||
|
let param = 'from';
|
||||||
|
let value = 'Fri Aug 10 2018 11:39:21 GMT+0200';
|
||||||
|
let result = controller.exprBuilder(param, value);
|
||||||
|
|
||||||
|
expect(result).toEqual({shipped: {gte: 'Fri Aug 10 2018 11:39:21 GMT+0200'}});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a formated object with the date in case of to', () => {
|
||||||
|
let param = 'to';
|
||||||
|
let value = 'Fri Aug 10 2018 11:39:21 GMT+0200';
|
||||||
|
let result = controller.exprBuilder(param, value);
|
||||||
|
|
||||||
|
expect(result).toEqual({shipped: {lte: 'Fri Aug 10 2018 11:39:21 GMT+0200'}});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a formated object with the nickname in case of nickname', () => {
|
||||||
|
let param = 'nickname';
|
||||||
|
let value = 'Bruce';
|
||||||
|
let result = controller.exprBuilder(param, value);
|
||||||
|
|
||||||
|
expect(result).toEqual({nickname: {regexp: 'Bruce'}});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a formated object with the warehouseFk in case of warehouseFk', () => {
|
||||||
|
let param = 'warehouseFk';
|
||||||
|
let value = 'Silla';
|
||||||
|
let result = controller.exprBuilder(param, value);
|
||||||
|
|
||||||
|
expect(result).toEqual({warehouseFk: 'Silla'});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('compareDate()', () => {
|
describe('compareDate()', () => {
|
||||||
it('should return warning when the date is the present', () => {
|
it('should return warning when the date is the present', () => {
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
|
@ -22,9 +72,9 @@ describe('ticket', () => {
|
||||||
expect(result).toEqual('warning');
|
expect(result).toEqual('warning');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return warning when the date is in the future', () => {
|
it('should return sucess when the date is in the future', () => {
|
||||||
let date = '2518-05-19T00:00:00.000Z';
|
let futureDate = '2518-05-19T00:00:00.000Z';
|
||||||
let result = controller.compareDate(date);
|
let result = controller.compareDate(futureDate);
|
||||||
|
|
||||||
expect(result).toEqual('success');
|
expect(result).toEqual('success');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue