Skip to content

Commit

Permalink
tests: add more test coverages
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Aug 15, 2023
1 parent d5c122d commit fdf731f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/invoices/InvoiceDetails/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,16 @@ describe('showUpdateInvoiceError', () => {
['incorrectFundDistributionTotal', 'ui-invoice.invoice.actions.approve.error.incorrectFundDistributionTotal', ['invoiceLineNumber']],
['budgetNotFoundByFundId', 'ui-invoice.invoice.actions.approve.error.budgetNotFoundByFundId', ['fund', 'fundCode']],
['budgetNotFoundByFundId', 'defaultErrorMessageId', []],
['fundCannotBePaid', 'ui-invoice.invoice.actions.approve.error.fundCannotBePaid', ['funds']],
])('should get %s error message', async (code, messageId, key) => {
const mockActionName = 'approve';
const parameters = key.map(k => ({ key: k, value: 'value' }));
let values = { values: { ...parameters.reduce((acc, { key: k, value }) => ({ ...acc, [k]: value }), {}) } };

if (code === 'budgetNotFoundByFundId') {
values = parameters.length ? { values: { fundCode: 'value' } } : {};
} else if (code === 'fundCannotBePaid') {
values = { values: { fundCodes: 'value' } };
}

const mockResponse = {
Expand Down

0 comments on commit fdf731f

Please sign in to comment.