39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
import './index';
|
|
|
|
describe('Ticket', () => {
|
|
describe('Component vnTicketExpedition', () => {
|
|
let controller;
|
|
let $scope;
|
|
let $state;
|
|
let $httpBackend;
|
|
|
|
beforeEach(ngModule('ticket'));
|
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
|
|
$state = _$state_;
|
|
$httpBackend = _$httpBackend_;
|
|
$scope = $rootScope.$new();
|
|
$scope.model = {
|
|
refresh: () => {}
|
|
};
|
|
controller = $componentController('vnTicketExpedition', {$state, $scope});
|
|
}));
|
|
|
|
describe('returnDialog()', () => {
|
|
it('should perform a DELETE query', () => {
|
|
spyOn($scope.model, 'refresh');
|
|
|
|
let response = 'ACCEPT';
|
|
controller.expeditionId = 1;
|
|
|
|
$httpBackend.when('DELETE', `/ticket/api/Expeditions/1`).respond(200);
|
|
$httpBackend.expect('DELETE', `/ticket/api/Expeditions/1`);
|
|
controller.returnDialog(response);
|
|
$httpBackend.flush();
|
|
|
|
expect($scope.model.refresh).toHaveBeenCalledWith();
|
|
});
|
|
});
|
|
});
|
|
});
|