Add unit tests for getDomainByFundID#95507
Conversation
Co-authored-by: Maxence Coulibaly <madmax330@users.noreply.github.com>
Co-authored-by: Maxence Coulibaly <madmax330@users.noreply.github.com>
|
Fixed the failing Oxfmt check by running What was wrong: oxfmt wanted the The other failing check, |
|
✅ The Oxfmt check is now passing — my earlier fix (e123b88) landed. The only remaining failing check is No further code fix is needed from me here. |
|
✅ All actionable checks are now green — the Oxfmt check fix I pushed earlier (e123b88) passed, along with The only remaining failing check is No further code fix is needed from me here. |
Explanation of Change
Follow-up to PR #93928, addressing
mountiny's review comment asking for unit tests to be added forgetDomainByFundIDin a follow-up.This PR adds unit-test coverage for
getDomainByFundIDintests/unit/CardUtilsTest.ts. That helper resolves theDomainbacking a fund (card account): it first looks the domain up by itsdomain_<fundID>key, then falls back to scanning for a domain whoseaccountIDmatches the fund. No production code is changed — this is test-only.The new
describe('getDomainByFundID', ...)block covers each branch of the helper:domain_<fundID>(primary path).accountIDmatches the fund when it isn't keyed by the fund ID.accountID.undefinedwhendomainsisundefined.undefinedwhen nothing is keyed by or matches the fund.undefinedentries while scanning for anaccountIDmatch.Fixed Issues
$
PROPOSAL:
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review".
// Please describe what tests you performed that validate your change worked.
npm test -- tests/unit/CardUtilsTest.ts -t "getDomainByFundID"and verify the newgetDomainByFundIDtests pass.Offline tests
N/A — unit-test-only change, no runtime/UI behavior is affected.
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review", or add "[No QA]" to the PR title.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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 — unit-test-only change with no UI impact.