2018-08-09 12:42:02 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('Ticket', () => {
|
|
|
|
describe('Component vnTicketExpedition', () => {
|
|
|
|
let controller;
|
|
|
|
let $scope;
|
|
|
|
let $state;
|
|
|
|
let $httpBackend;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('ticket'));
|
2018-08-09 12:42:02 +00:00
|
|
|
|
2018-12-22 10:59:26 +00:00
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
|
2018-08-09 12:42:02 +00:00
|
|
|
$state = _$state_;
|
|
|
|
$httpBackend = _$httpBackend_;
|
|
|
|
$scope = $rootScope.$new();
|
|
|
|
$scope.model = {
|
|
|
|
refresh: () => {}
|
|
|
|
};
|
2018-12-22 10:59:26 +00:00
|
|
|
controller = $componentController('vnTicketExpedition', {$state, $scope});
|
2018-08-09 12:42:02 +00:00
|
|
|
}));
|
|
|
|
|
2018-09-04 09:57:41 +00:00
|
|
|
describe('returnDialog()', () => {
|
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
|
|
|
|
2019-10-30 15:57:14 +00:00
|
|
|
let response = 'accept';
|
2018-09-04 09:57:41 +00:00
|
|
|
controller.expeditionId = 1;
|
2018-08-09 12:42:02 +00:00
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
$httpBackend.when('DELETE', `Expeditions/1`).respond(200);
|
|
|
|
$httpBackend.expect('DELETE', `Expeditions/1`);
|
2018-09-04 09:57:41 +00:00
|
|
|
controller.returnDialog(response);
|
2018-08-09 12:42:02 +00:00
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect($scope.model.refresh).toHaveBeenCalledWith();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|