[No QA] Clean up unsafe type assertions in unit tests - #97360
Draft
KJ21-ENG wants to merge 4 commits into
Draft
Conversation
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 test-only cleanup removes 172
@typescript-eslint/no-unsafe-type-assertionfindings from the ten authorized unit-test files. It replaces unsafe assertions with production-derived types, typed mocks and fixtures, and narrow type-safe handling for intentional malformed runtime fixtures while preserving the existing test scenarios and runtime behavior.Fixed Issues
$ #94739
PROPOSAL: #94739 (comment)
Count change
Current baseline source:
config/eslint/eslint.seatbelt.tsvat base2c95456c78d65e54730dcde1f758292472ab59farecords the baseline for@typescript-eslint/no-unsafe-type-assertion.Before:
tests/unit/BankAccountUtilsTest.ts: 16 findingstests/unit/ImportTransactions.test.ts: 16 findingstests/unit/ReportUtilsTest.ts: 19 findingstests/unit/TransactionUtilsTest.ts: 20 findingstests/unit/ViolationUtilsTest.ts: 20 findingstests/unit/hooks/useAssignCard.test.ts: 16 findingstests/unit/hooks/useFilterFormValues.test.ts: 15 findingstests/unit/hooks/useSearchBulkActionsDuplicateTest.ts: 19 findingstests/unit/libs/SplitExpenseUtils.test.ts: 15 findingstests/unit/useAccountIndicatorChecksTest.ts: 16 findingsAfter:
tests/unit/BankAccountUtilsTest.ts: 0 findingstests/unit/ImportTransactions.test.ts: 0 findingstests/unit/ReportUtilsTest.ts: 0 findingstests/unit/TransactionUtilsTest.ts: 0 findingstests/unit/ViolationUtilsTest.ts: 0 findingstests/unit/hooks/useAssignCard.test.ts: 0 findingstests/unit/hooks/useFilterFormValues.test.ts: 0 findingstests/unit/hooks/useSearchBulkActionsDuplicateTest.ts: 0 findingstests/unit/libs/SplitExpenseUtils.test.ts: 0 findingstests/unit/useAccountIndicatorChecksTest.ts: 0 findingsNet reduction:
@typescript-eslint/no-unsafe-type-assertionfindings across the ten target files.TSV evidence:
78c65d10d9a14eecc2aff2dbb488b7071bce4e51reported zero remaining findings for every target, and the tracked TSV was restored unchanged.Tests
git diff --checkfor all ten targets.30467957722passed typecheck, lint, format, React Compiler, and Jest for exact head78c65d10d9a14eecc2aff2dbb488b7071bce4e51.Offline tests
N/A — this is a test-only type-safety cleanup; it changes no application runtime or network behavior, and no manual offline test was performed.
QA Steps
N/A — this is a test-only cleanup and the title starts with
[No QA]; no staging or production manual QA was performed.PR Author Checklist
Checklist note: every item below is checked to record that it was considered. Platform, staging or production, offline, screenshot or video, high-traffic, console, and product-component testing are N/A for this test-only cleanup; no manual platform or product testing is claimed. The automated evidence is listed in
### Tests.### 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 changes; no screenshots or videos were produced.
Changed files (10)
tests/unit/BankAccountUtilsTest.tstests/unit/ImportTransactions.test.tstests/unit/ReportUtilsTest.tstests/unit/TransactionUtilsTest.tstests/unit/ViolationUtilsTest.tstests/unit/hooks/useAssignCard.test.tstests/unit/hooks/useFilterFormValues.test.tstests/unit/hooks/useSearchBulkActionsDuplicateTest.tstests/unit/libs/SplitExpenseUtils.test.tstests/unit/useAccountIndicatorChecksTest.ts