36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
import './index';
|
|
import crudModel from 'core/mocks/crud-model';
|
|
|
|
describe('Ticket', () => {
|
|
describe('Component vnTicketDmsIndex', () => {
|
|
let $httpBackend;
|
|
let controller;
|
|
|
|
beforeEach(ngModule('ticket'));
|
|
|
|
beforeEach(inject(($componentController, _$httpBackend_) => {
|
|
$httpBackend = _$httpBackend_;
|
|
controller = $componentController('vnTicketDmsIndex', {$element: null});
|
|
controller.$.model = crudModel;
|
|
}));
|
|
|
|
describe('deleteDms()', () => {
|
|
it('should make an HTTP Post query', () => {
|
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
jest.spyOn(controller.$.model, 'remove');
|
|
|
|
const dmsId = 1;
|
|
const dmsIndex = 0;
|
|
controller.ticketDms = [{dmsFk: 1}];
|
|
|
|
$httpBackend.expectPOST(`ticketDms/${dmsId}/removeFile`).respond({});
|
|
controller.deleteDms(dmsIndex);
|
|
$httpBackend.flush();
|
|
|
|
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
|
});
|
|
});
|
|
});
|
|
});
|