Skip to content

[No QA] Remove unsafe type assertions from ReportSecondaryActionUtilsTest.ts#1

Closed
KJ21-ENG wants to merge 10000 commits into
mainfrom
sbf/manual-3e60941c-81e7-4ccd-a2dc-bf17daaac1df-94739-publication
Closed

[No QA] Remove unsafe type assertions from ReportSecondaryActionUtilsTest.ts#1
KJ21-ENG wants to merge 10000 commits into
mainfrom
sbf/manual-3e60941c-81e7-4ccd-a2dc-bf17daaac1df-94739-publication

Conversation

@KJ21-ENG

Copy link
Copy Markdown
Owner

Explanation of Change

Removed @typescript-eslint/no-unsafe-type-assertion violations from tests/unit/ReportSecondaryActionUtilsTest.ts as part of the cleanup for Expensify/App issue Expensify#94739.

What changed:

  • Replaced unsafe Report, Policy, and Transaction assertions with createMock<T>.
  • Replaced untyped mock callbacks and any casts with typed mock definitions.
  • Used jest.mocked for the isPolicyAdmin mocks.

Why this approach is safe:

  • Only test setup and typing changed.
  • Existing scenarios, fixtures, and assertions remain unchanged.
  • No production behavior is affected.

Reviewer focus:

  • Confirm the typed mocks preserve the existing test behavior and accepted argument types.

Fixed Issues

$ Expensify#94739
PROPOSAL: Expensify#94739 (comment)

Count change

Current baseline source:

  • config/eslint/eslint.seatbelt.tsv

Before:

  • tests/unit/ReportSecondaryActionUtilsTest.ts: 31 violations

After:

  • tests/unit/ReportSecondaryActionUtilsTest.ts: 0 violations

Net reduction:

  • 31 fewer @typescript-eslint/no-unsafe-type-assertion violations.

TSV evidence:

  • The generated TSV was restored byte-for-byte and is not included in this PR.

Tests

  1. Run:
    npm run lint -- --show-warnings tests/unit/ReportSecondaryActionUtilsTest.ts
  2. Run:
    CI=true npm run lint -- --no-cache --show-warnings tests/unit/ReportSecondaryActionUtilsTest.ts
  3. Run:
    npm run test -- tests/unit/ReportSecondaryActionUtilsTest.ts

The focused Jest suite passed all 165 tests. Focused lint, formatting, TSV restoration, and diff hygiene also passed.

Offline tests

Not applicable: this test-only cleanup adds no network behavior.

QA Steps

Not applicable: production behavior and UI are unchanged.

PR Author Checklist

  • I linked the correct issue above.
  • I included focused testing steps.
  • I verified that no production behavior changed.
  • I verified that the generated TSV was restored.
  • I confirmed that no screenshots are required for this test-only change.

Screenshots/Videos

Not applicable: only a unit-test source file changed.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.