From f669e7148cc62f8bb625221a74a579e6bd57529b Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 14 Dec 2021 08:33:29 +0100 Subject: [PATCH] onAcceptToBook test ok --- modules/invoiceIn/front/descriptor/index.spec.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/invoiceIn/front/descriptor/index.spec.js b/modules/invoiceIn/front/descriptor/index.spec.js index e7215b6dc..578128b7c 100644 --- a/modules/invoiceIn/front/descriptor/index.spec.js +++ b/modules/invoiceIn/front/descriptor/index.spec.js @@ -8,7 +8,9 @@ describe('vnInvoiceInDescriptor', () => { beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; - controller = $componentController('vnInvoiceInDescriptor', {$element: null}); + const $element = angular.element(''); + + controller = $componentController('vnInvoiceInDescriptor', {$element}); controller.invoiceIn = {id: 1}; $httpBackend.when('GET', `InvoiceIns/${controller.invoiceIn.id}`).respond({id: 1}); })); @@ -21,7 +23,9 @@ describe('vnInvoiceInDescriptor', () => { describe('onAcceptToBook()', () => { it(`should perform a post query to book the invoice`, () => { - controller.vnApp = {showSuccess: jest.fn()}; + jest.spyOn(controller.vnApp, 'showSuccess'); + controller.$state.reload = jest.fn(); + const id = 1; $httpBackend.expectPOST(`InvoiceIns/${id}/toBook`).respond();