[No QA] Remove unsafe type assertions from tests - #97509
Conversation
|
@ikevin127 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
e6d43ca to
49bd46e
Compare
|
@ikevin127 Could you please take a look at this when you get a chance? Thanks! |
|
@KJ21-ENG Please let me know when this is ready for review - as I noticed it was marked as draft again. |
|
@ikevin127 Could you please take a look at this when you get a chance? Thanks! |
Reviewer Checklist
|
ikevin127
left a comment
There was a problem hiding this comment.
🟢 LGTM
One of the stronger entries in the series. Alongside the usual jest.mocked() / createMock / typed-fetch-mock swaps, three files got genuinely better, not just retyped: ResizeScreenTests now asserts the hook forwards getState() into reset(), ReportActionsUtils.perf-test fixed a latent linkMetaData→linkmetadata typo the old as unknown as was hiding, and UpdateMoneyRequestTest replaced ?.value as OnyxEntry<SearchResults> with a proper Extract<OnyxUpdate<...>, {onyxMethod}> type-guarded .find.
No blockers.
Explanation of Change
Replace unsafe type assertions in the selected test fixtures and mocks with
production-derived types, typed mock helpers, and direct narrowing. The
navigation resize test now reads the live navigation state, forwards the exact
state to reset, and verifies that reset received that state. Test scenarios and
runtime behavior are preserved.
Fixed Issues
$ #94739
PROPOSAL: #94739 (comment)
Tests
target test files pass.
and Jest checks in provider run
30826369122.Offline tests
N/A — this is a test-only cleanup with no application runtime or network behavior change.
QA Steps
N/A — this is a test-only cleanup; no staging or production QA flow is applicable.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Count change
Current baseline source:
config/eslint/eslint.seatbelt.tsvinventory on the pinned base.Before:
tests/actions/AppTest.ts: 4tests/actions/IOU/SearchUpdateTest.ts: 4tests/actions/IOUTest/HoldTest.ts: 4tests/actions/IOUTest/SendInvoiceTest.ts: 4tests/actions/IOUTest/UpdateMoneyRequestTest.ts: 4tests/actions/OnyxUpdateManagerTest.ts: 4tests/actions/connections/QuickbooksOnline.ts: 4tests/navigation/ResizeScreenTests.tsx: 4tests/perf-test/ReportActionsUtils.perf-test.ts: 4tests/ui/ProfilePageTest.tsx: 4tests/ui/ReportActionAvatarsTest.tsx: 4tests/ui/components/ComposedButton.tsx: 4tests/ui/components/IOURequestStepConfirmationPageTest.tsx: 4tests/unit/ValidateAttachmentFileTest.ts: 5After:
Net reduction:
TSV evidence:
Screenshots/Videos
N/A — this test-only cleanup introduces no user-facing UI change.
Changed files (14)
tests/actions/AppTest.tstests/actions/IOU/SearchUpdateTest.tstests/actions/IOUTest/HoldTest.tstests/actions/IOUTest/SendInvoiceTest.tstests/actions/IOUTest/UpdateMoneyRequestTest.tstests/actions/OnyxUpdateManagerTest.tstests/actions/connections/QuickbooksOnline.tstests/navigation/ResizeScreenTests.tsxtests/perf-test/ReportActionsUtils.perf-test.tstests/ui/ProfilePageTest.tsxtests/ui/ReportActionAvatarsTest.tsxtests/ui/components/ComposedButton.tsxtests/ui/components/IOURequestStepConfirmationPageTest.tsxtests/unit/ValidateAttachmentFileTest.ts