refs #5284 test createClaim
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2023-04-13 13:41:10 +02:00
parent 15d7139bc5
commit 90268a79b0
1 changed files with 16 additions and 1 deletions

View File

@ -45,6 +45,7 @@ describe('Ticket', () => {
$scope.model = crudModel;
$scope.editDiscount = {relocate: () => {}, hide: () => {}};
$scope.editPricePopover = {relocate: () => {}};
$scope.claimConfirm = {show: () => {}};
$httpBackend = _$httpBackend_;
Object.defineProperties($state.params, {
id: {
@ -61,6 +62,10 @@ describe('Ticket', () => {
controller.card = {reload: () => {}};
controller._ticket = ticket;
controller._sales = sales;
controller.ticketConfig = [
{daysForWarningClaim: 2}
];
$httpBackend.expect('GET', 'TicketConfigs').respond(200);
}));
describe('ticket() setter', () => {
@ -113,7 +118,6 @@ describe('Ticket', () => {
it('should make an HTTP GET query and return the worker mana', () => {
controller.edit = {};
const expectedAmount = 250;
$httpBackend.expect('GET', 'Tickets/1/getSalesPersonMana').respond(200, expectedAmount);
$httpBackend.expect('GET', 'Sales/usesMana').respond(200);
$httpBackend.expect('GET', 'WorkerManas/getCurrentWorkerMana').respond(200, expectedAmount);
@ -279,6 +283,17 @@ describe('Ticket', () => {
});
describe('createClaim()', () => {
it('should perform a query and call windows open', () => {
jest.spyOn(controller.$.claimConfirm, 'show').mockReturnThis();
controller.createClaim();
$httpBackend.flush();
expect(controller.$.claimConfirm);
});
});
describe('onCreateClaimAccepted()', () => {
it('should perform a query and call windows open', () => {
jest.spyOn(controller, 'resetChanges').mockReturnThis();
jest.spyOn(controller.$state, 'go').mockReturnThis();