onAcceptToBook test ok
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2021-12-14 08:33:29 +01:00
parent d0326fe354
commit f669e7148c
1 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,9 @@ describe('vnInvoiceInDescriptor', () => {
beforeEach(inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnInvoiceInDescriptor', {$element: null});
const $element = angular.element('<vn-invoice-in-descriptor></vn-invoice-in-descriptor>');
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();