[No QA] Remove unsafe type assertions from ten test files - #97284
Open
KJ21-ENG wants to merge 1 commit into
Open
[No QA] Remove unsafe type assertions from ten test files#97284KJ21-ENG wants to merge 1 commit into
KJ21-ENG wants to merge 1 commit into
Conversation
KJ21-ENG
force-pushed
the
seatbelt/94739-tests-20260728-explicit
branch
from
July 31, 2026 08:56
7ea3dae to
423fb46
Compare
KJ21-ENG
force-pushed
the
seatbelt/94739-tests-20260728-explicit
branch
from
July 31, 2026 11:36
423fb46 to
faa811f
Compare
KJ21-ENG
marked this pull request as ready for review
July 31, 2026 14:26
|
@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] |
Contributor
Reviewer Checklist
|
ikevin127
reviewed
Aug 1, 2026
ikevin127
left a comment
Contributor
There was a problem hiding this comment.
🟢 LGTM
Notes (no change requested)
- The two new
@ts-expect-error Intentionally exercise the runtime guard...inuseAllTransactions.test.tsare the honest way to injectnull/undefinedentries into a strictly-typedSearchResults['data']to exercise the hook's runtime filtering. They are narrowly scoped to exactly the two malformed entries, carry a clear reason, and are a different rule from the one this issue targets. The rest of that object is now fully type-checked viacreateMock, which is stricter than the old whole-objectas unknown as SearchResults. class MockFile extends BlobinPersistedRequests.tsis a real File stub replacingfunction MockFile() {}+as unknown as typeof File+Object.create(...) as File.global.File = MockFilenow typechecks with no cast because the class actually implements theFilesurface. Good direction.chunkLoadErrorRecoveryTest.tsdeletes the localtype ComponentImport<T>and usesjest.fn<Promise<{default: ComponentType}>, []>()instead ofas unknown as ComponentImport<...>— exactly the "typedjest.fn, no local type" pattern.
38 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
This issue 94739 cleanup removes unsafe type assertions from ten authorized test targets. It replaces them with production-linked types, typed mocks and fixtures, and narrow exceptions only for intentionally malformed runtime fixtures. Current main renamed
StateSelectionPageTest.tsxtoDynamicStateSelectionPageTest.tsx; the guarded rebuild preserves that rename and the current Dynamic page scenarios. No production source files are changed.Fixed Issues
$ #94739
PROPOSAL: #94739 (comment)
Tests
30627964194passed typecheck, lint, format, React Compiler, and Jest forfaa811f10ad2d7e023a90b5160bd1eb49f8623df.git diff --checkpassed and the generated Seatbelt TSV was restored.Offline tests
N/A: this is a test-only type-safety cleanup with no application runtime or network behavior change. Offline and spotty-network manual testing were not performed.
QA Steps
N/A under the
[No QA]title: this PR changes test code only. No staging, production, High Traffic account, platform, failure-scenario, or manual QA testing was performed.Count change
Current baseline source: the tracked Seatbelt TSV at original run base
2c95456c78d65e54730dcde1f758292472ab59fa; theStateSelectionPageTest.tsxentry subsequently migrated to its deterministic rename successorDynamicStateSelectionPageTest.tsx.Before:
tests/ui/AuthScreensInitHandlerTest.tsx: 7tests/ui/StateSelectionPageTest.tsx: 7tests/ui/StateSelectorModalTest.tsx: 7tests/unit/ChatGPTTranslatorTest.ts: 7tests/unit/DeeplinkRouteNormalizationTest.ts: 7tests/unit/FailureTrackingTest.ts: 7tests/unit/PersistedRequests.ts: 7tests/unit/QuickActionUtilsTest.ts: 7tests/unit/chunkLoadErrorRecoveryTest.ts: 7tests/unit/hooks/useAllTransactions.test.ts: 7After:
tests/ui/AuthScreensInitHandlerTest.tsx: 0tests/ui/DynamicStateSelectionPageTest.tsx: 0tests/ui/StateSelectorModalTest.tsx: 0tests/unit/ChatGPTTranslatorTest.ts: 0tests/unit/DeeplinkRouteNormalizationTest.ts: 0tests/unit/FailureTrackingTest.ts: 0tests/unit/PersistedRequests.ts: 0tests/unit/QuickActionUtilsTest.ts: 0tests/unit/chunkLoadErrorRecoveryTest.ts: 0tests/unit/hooks/useAllTransactions.test.ts: 0Net reduction:
TSV evidence: deterministic verification reported zero for every rebuilt target and restored
config/eslint/eslint.seatbelt.tsvafter counting.PR Author Checklist
All checklist entries were considered. Platform, offline, screenshots, assets, CSS, UI, copy, production API, markdown, Storybook, generic-component, and manual-console items are N/A because this is a test-only cleanup; no unsupported manual testing is claimed. The test changes and current-main rebuild were covered by focused verification, three independent reviews, and exact-head Fork CI.
### 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.Screenshots/Videos
N/A: no UI or runtime behavior changed, and no screenshots or videos were produced.
Changed files (10)
tests/ui/AuthScreensInitHandlerTest.tsxtests/ui/DynamicStateSelectionPageTest.tsxtests/ui/StateSelectorModalTest.tsxtests/unit/ChatGPTTranslatorTest.tstests/unit/DeeplinkRouteNormalizationTest.tstests/unit/FailureTrackingTest.tstests/unit/PersistedRequests.tstests/unit/QuickActionUtilsTest.tstests/unit/chunkLoadErrorRecoveryTest.tstests/unit/hooks/useAllTransactions.test.ts