Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8846,7 +8846,6 @@ function canIOUBePaid(
invoiceReceiverPolicy?: SearchPolicy,
shouldCheckApprovedState = true,
) {
const isPolicyExpenseChat = isPolicyExpenseChatReportUtil(chatReport);
const reportNameValuePairs = chatReportRNVP ?? allReportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${chatReport?.reportID}`];
const isChatReportArchived = isArchivedReport(reportNameValuePairs);
const iouSettled = isSettled(iouReport);
Expand Down Expand Up @@ -8884,7 +8883,7 @@ function canIOUBePaid(
policy,
);

const isOpenExpenseReport = isPolicyExpenseChat && isOpenExpenseReportReportUtils(iouReport);
const isOpenExpenseReport = isOpenExpenseReportReportUtils(iouReport);

const {reimbursableSpend} = getMoneyRequestSpendBreakdown(iouReport);
const isAutoReimbursable = policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES ? false : canBeAutoReimbursed(iouReport, policy);
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/Search/SearchUIUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ const reportActionListItems = [
const transactionsListItems = [
{
accountID: 18439984,
action: 'pay',
action: 'submit',
amount: -5000,
canDelete: true,
canHold: true,
Expand Down Expand Up @@ -599,7 +599,7 @@ const transactionsListItems = [
const reportsListItems = [
{
accountID: 18439984,
action: 'pay',
action: 'submit',
chatReportID: '1706144653204915',
created: '2024-12-21 13:05:20',
currency: 'USD',
Expand Down Expand Up @@ -631,7 +631,7 @@ const reportsListItems = [
transactions: [
{
accountID: 18439984,
action: 'pay',
action: 'submit',
amount: -5000,
canDelete: true,
canHold: true,
Expand Down Expand Up @@ -818,15 +818,15 @@ const reportsListItems = [

describe('SearchUIUtils', () => {
describe('Test getAction', () => {
test('Should return `Pay` action for transaction on policy with no approvals and no violations', () => {
test('Should return `Submit` action for transaction on policy with delayed submission and no violations', () => {
let action = SearchUIUtils.getAction(searchResults.data, `report_${reportID}`);
expect(action).toStrictEqual(CONST.SEARCH.ACTION_TYPES.PAY);
expect(action).toStrictEqual(CONST.SEARCH.ACTION_TYPES.SUBMIT);

action = SearchUIUtils.getAction(searchResults.data, `transactions_${transactionID}`);
expect(action).toStrictEqual(CONST.SEARCH.ACTION_TYPES.PAY);
expect(action).toStrictEqual(CONST.SEARCH.ACTION_TYPES.SUBMIT);
});

test('Should return `Review` action for transaction on policy with no approvals and with violations', () => {
test('Should return `Review` action for transaction on policy with delayed submission and with violations', () => {
let action = SearchUIUtils.getAction(searchResults.data, `report_${reportID2}`);
expect(action).toStrictEqual(CONST.SEARCH.ACTION_TYPES.REVIEW);

Expand Down