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;
|
2019-09-06 07:47:58 +00:00
|
|
|
let $state;
|
2018-11-08 14:20:42 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
const ticket = {
|
|
|
|
id: 2,
|
|
|
|
clientFk: 101,
|
|
|
|
invoiceOut: {id: 1},
|
|
|
|
client: {
|
|
|
|
id: 101,
|
|
|
|
email: 'client@email'
|
|
|
|
},
|
|
|
|
address: {
|
|
|
|
id: 101,
|
|
|
|
mobile: 111111111,
|
|
|
|
phone: 2222222222
|
|
|
|
},
|
|
|
|
tracking: {
|
|
|
|
state: {alertLevel: 3}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
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_;
|
2020-04-30 10:48:52 +00:00
|
|
|
$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;
|
2020-04-30 10:48:52 +00:00
|
|
|
}));
|
2018-11-08 14:20:42 +00:00
|
|
|
|
2020-04-30 10:48:52 +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();
|
2020-04-30 10:48:52 +00:00
|
|
|
$httpBackend.flush();
|
2020-03-11 07:45:54 +00:00
|
|
|
});
|
|
|
|
});
|
2018-11-08 14:20:42 +00:00
|
|
|
});
|