salix/modules/ticket/front/descriptor/index.spec.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-11-08 14:20:42 +00:00
import './index.js';
2019-11-25 06:46:00 +00:00
describe('Ticket Component vnTicketDescriptor', () => {
2018-11-08 14:20:42 +00:00
let $httpBackend;
let controller;
let $state;
2018-11-08 14:20:42 +00:00
const ticket = {
id: 2,
clientFk: 1101,
invoiceOut: {id: 1},
client: {
id: 1101,
email: 'client@email'
},
address: {
id: 1101,
mobile: 111111111,
phone: 2222222222
},
tracking: {
state: {alertLevel: 3}
}
};
beforeEach(ngModule('ticket'));
2018-11-08 14:20:42 +00:00
2020-07-23 14:46:16 +00:00
beforeEach(inject(($componentController, _$httpBackend_, _$state_) => {
2018-11-08 14:20:42 +00:00
$httpBackend = _$httpBackend_;
$state = _$state_;
2020-06-17 07:49:14 +00:00
$state.params.id = 1;
2018-11-08 14:20:42 +00:00
2020-11-10 09:38:25 +00:00
const $element = angular.element('<vn-ticket-descriptor></vn-ticket-descriptor>');
controller = $componentController('vnTicketDescriptor', {$element});
controller.ticket = ticket;
}));
2018-11-08 14:20:42 +00:00
describe('loadData()', () => {
it(`should perform a get query to store the ticket data into the controller`, () => {
2020-11-10 09:38:25 +00:00
$httpBackend.expect('GET', `Tickets/${ticket.id}`).respond();
2020-09-02 11:09:30 +00:00
controller.loadData();
$httpBackend.flush();
2020-03-11 07:45:54 +00:00
});
});
2018-11-08 14:20:42 +00:00
});