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
4 changes: 2 additions & 2 deletions tests/actions/ReportPreviewActionUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ describe('getReportPreviewAction', () => {
).toBe(CONST.REPORT.REPORT_PREVIEW_ACTIONS.SUBMIT);
});

it('canSubmit should return true for expense preview report with only pending transactions', async () => {
it('getReportPreviewAction should return VIEW for expense preview report with only pending transactions', async () => {
const report: Report = {
...createRandomReport(REPORT_ID, undefined),
type: CONST.REPORT.TYPE.EXPENSE,
Expand Down Expand Up @@ -365,7 +365,7 @@ describe('getReportPreviewAction', () => {
reportMetadata: undefined,
ownerLogin: CURRENT_USER_EMAIL,
}),
).toBe(CONST.REPORT.REPORT_PREVIEW_ACTIONS.SUBMIT);
).toBe(CONST.REPORT.REPORT_PREVIEW_ACTIONS.VIEW);
});

it('canSubmit should return false for expense preview report with smartscan failed violation', async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/ReportSecondaryActionUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ describe('getSecondaryAction', () => {
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.SUBMIT)).toBe(false);
});

it('should include SUBMIT option for admin with only pending transactions', async () => {
it('should not include SUBMIT option for admin with only pending transactions', async () => {
const report = createMock<Report>({
reportID: REPORT_ID,
type: CONST.REPORT.TYPE.EXPENSE,
Expand Down Expand Up @@ -681,7 +681,7 @@ describe('getSecondaryAction', () => {
policy,
isProduction: false,
});
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.SUBMIT)).toBe(true);
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.SUBMIT)).toBe(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the pending-transaction test exercise submit eligibility

This assertion now passes even if the pending-transaction guard in isSubmitAction is removed, because the policy mock above omits type, so isGroupPolicy(policy) is false and getSecondaryReportActions suppresses SUBMIT before this scenario distinguishes pending transactions from a normal submittable report. Since this test is meant to cover the all-pending transaction behavior, please make the fixture otherwise eligible to submit, e.g. set type: CONST.POLICY.TYPE.CORPORATE, so it would fail for the intended regression.

Useful? React with 👍 / 👎.

});

it('should not include SUBMIT option when transaction has smartscan failed violation', async () => {
Expand Down
Loading