try to fix frontTest
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-10-17 13:02:19 +02:00
parent 86d24ffede
commit 8ab6a50c73
1 changed files with 28 additions and 2 deletions

View File

@ -19,6 +19,7 @@ describe('InvoiceOut', () => {
} }
}; };
controller = $componentController('vnInvoiceOutGlobalInvoicing', {$element, $scope, $transclude}); controller = $componentController('vnInvoiceOutGlobalInvoicing', {$element, $scope, $transclude});
controller.$.invoiceButton = {disabled: false};
})); }));
describe('getMinClientId()', () => { describe('getMinClientId()', () => {
@ -86,14 +87,39 @@ describe('InvoiceOut', () => {
it('should make an http POST query and then call to the showSuccess() method', () => { it('should make an http POST query and then call to the showSuccess() method', () => {
jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.vnApp, 'showSuccess');
const filter = {
order: 'id DESC',
limit: 1
};
const minShipped = new Date();
minShipped.setFullYear(minShipped.getFullYear() - 1);
minShipped.setMonth(1);
minShipped.setDate(1);
minShipped.setHours(0, 0, 0, 0);
controller.invoice = { controller.invoice = {
invoiceDate: new Date(), invoiceDate: new Date(),
maxShipped: new Date(), maxShipped: new Date(),
fromClientId: 1101, fromClientId: 1101,
toClientId: 1101 toClientId: 1101,
companyFk: 442,
minShipped: minShipped
};
const response = {
clientsAndAddresses: [{clientId: 1101, addressId: 121}],
invoice: controller.invoice
};
const expectedParams = {
clientId: 1101,
addressId: 121,
invoiceDate: new Date(),
maxShipped: new Date(),
companyFk: 442,
minShipped: minShipped
}; };
const serializedParams = $httpParamSerializer({filter});
$httpBackend.expectGET(`Clients/findOne?${serializedParams}`).respond(200, {id: 1112});
$httpBackend.expect('POST', `InvoiceOuts/clientToInvoice`).respond(response);
$httpBackend.expect('POST', `InvoiceOuts/globalInvoicing`).respond({id: 1}); $httpBackend.expect('POST', `InvoiceOuts/globalInvoicing`).respond({id: 1});
controller.responseHandler('accept'); controller.responseHandler('accept');
$httpBackend.flush(); $httpBackend.flush();