2018-08-09 12:42:02 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('Ticket', () => {
|
|
|
|
describe('Component vnTicketExpedition', () => {
|
|
|
|
let controller;
|
|
|
|
let $scope;
|
|
|
|
let $httpBackend;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('ticket'));
|
2018-08-09 12:42:02 +00:00
|
|
|
|
2020-03-18 07:35:59 +00:00
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
2018-08-09 12:42:02 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
|
|
|
$scope = $rootScope.$new();
|
|
|
|
$scope.model = {
|
|
|
|
refresh: () => {}
|
|
|
|
};
|
2020-04-28 12:26:02 +00:00
|
|
|
controller = $componentController('vnTicketExpedition', {$element: null, $scope});
|
2018-08-09 12:42:02 +00:00
|
|
|
}));
|
|
|
|
|
2020-04-28 12:26:02 +00:00
|
|
|
describe('onDialogAccept()', () => {
|
2018-08-09 12:42:02 +00:00
|
|
|
it('should perform a DELETE query', () => {
|
2020-02-26 12:22:52 +00:00
|
|
|
jest.spyOn($scope.model, 'refresh');
|
2018-08-09 12:42:02 +00:00
|
|
|
|
2020-04-28 12:26:02 +00:00
|
|
|
const id = 1;
|
2018-08-09 12:42:02 +00:00
|
|
|
|
2020-04-28 12:26:02 +00:00
|
|
|
$httpBackend.expectDELETE(`Expeditions/${id}`).respond(200);
|
|
|
|
controller.onDialogAccept(id);
|
2018-08-09 12:42:02 +00:00
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect($scope.model.refresh).toHaveBeenCalledWith();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|