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

31 lines
818 B
JavaScript

import './index.js';
describe('vnTicketDescriptorPopover', () => {
let controller;
let $httpBackend;
beforeEach(ngModule('ticket'));
beforeEach(inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnTicketDescriptorPopover', {
$element: null,
$transclude: null
});
}));
describe('loadData()', () => {
it(`should perform a get query to store the ticket data into the controller`, () => {
const id = 1;
const response = 'foo';
$httpBackend.expectGET(`Tickets/${id}`).respond(response);
controller.id = id;
$httpBackend.flush();
expect(controller.ticket).toEqual(response);
});
});
});