salix/modules/ticket/front/search-panel/index.spec.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

import './index';
describe('Ticket Component vnTicketSearchPanel', () => {
let $httpBackend;
let controller;
beforeEach(ngModule('ticket'));
beforeEach(inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnTicketSearchPanel', {$element: null});
controller.$t = () => {};
}));
describe('getGroupedStates()', () => {
it('should set an array of groupedStates with the aditionof a name translation', () => {
jest.spyOn(controller, '$t').mockReturnValue('miCodigo');
const data = [
{
alertLevel: 9999,
code: 'myCode'
}
];
$httpBackend.whenGET('AlertLevels').respond(data);
controller.getGroupedStates();
$httpBackend.flush();
expect(controller.groupedStates).toEqual([{
alertLevel: 9999,
code: 'myCode',
name: 'miCodigo'
}]);
});
});
});