refactor createChildReport to use isSelfTourViewed from useOnyx#87914
refactor createChildReport to use isSelfTourViewed from useOnyx#87914dukenv0307 wants to merge 6 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@DylanDylann 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] |
|
PR doesn’t need product input as a refactor PR. Unassigning and unsubscribing myself. |
|
@DylanDylann It's ready for review |
|
@codex review |
| it('should pass isSelfTourViewed=true through to openReport when creating a new child report', async () => { | ||
| const PARENT_REPORT = createRandomReport(1, undefined); | ||
| const PARENT_REPORT_ACTION: OnyxTypes.ReportAction = { | ||
| ...createRandomReportAction(REPORT_ACTION_ID), | ||
| reportActionID: '1', | ||
| actorAccountID: TEST_USER_ACCOUNT_ID, | ||
| }; | ||
|
|
||
| await TestHelper.signInWithTestUser(TEST_USER_ACCOUNT_ID, TEST_USER_LOGIN); | ||
| await TestHelper.setPersonalDetails(TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID); | ||
| Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); | ||
| await waitForBatchedUpdates(); | ||
|
|
||
| Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, true); | ||
| await waitForBatchedUpdates(); | ||
|
|
||
| TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); | ||
| expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(MOCK_NEW_THREAD_REPORT_ID)); | ||
| }); | ||
|
|
||
| it('should pass isSelfTourViewed=false through to openReport when creating a new child report', async () => { | ||
| const PARENT_REPORT = createRandomReport(1, undefined); | ||
| const PARENT_REPORT_ACTION: OnyxTypes.ReportAction = { | ||
| ...createRandomReportAction(REPORT_ACTION_ID), | ||
| reportActionID: '1', | ||
| actorAccountID: TEST_USER_ACCOUNT_ID, | ||
| }; | ||
|
|
||
| await TestHelper.signInWithTestUser(TEST_USER_ACCOUNT_ID, TEST_USER_LOGIN); | ||
| await TestHelper.setPersonalDetails(TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID); | ||
| Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); | ||
| await waitForBatchedUpdates(); | ||
|
|
||
| Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, false); | ||
| await waitForBatchedUpdates(); | ||
|
|
||
| TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); | ||
| expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(MOCK_NEW_THREAD_REPORT_ID)); | ||
| }); | ||
|
|
There was a problem hiding this comment.
I am not sure what you want to verify in this test? Could you please clarify?
There was a problem hiding this comment.
Currently, the test only verifies that OPEN_REPORT is called, regardless of the value of isSelfTourViewed.
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@DylanDylann It's ready for review again |
| it('should pass isSelfTourViewed=true through to createChildReport when creating a new explain thread', async () => { | ||
| const PARENT_REPORT = createRandomReport(1, undefined); | ||
| const REPORT_ACTION: OnyxTypes.ReportAction = { | ||
| ...createRandomReportAction(REPORT_ACTION_ID), | ||
| reportActionID: '1', | ||
| actorAccountID: TEST_USER_ACCOUNT_ID, | ||
| }; | ||
|
|
||
| await TestHelper.signInWithTestUser(TEST_USER_ACCOUNT_ID, TEST_USER_LOGIN); | ||
| await TestHelper.setPersonalDetails(TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID); | ||
| Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); | ||
| await waitForBatchedUpdates(); | ||
|
|
||
| Report.explain(undefined, PARENT_REPORT, REPORT_ACTION, TestHelper.translateLocal, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, true, CONST.DEFAULT_TIME_ZONE); | ||
| await waitForBatchedUpdates(); | ||
|
|
||
| TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); | ||
| expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(MOCK_NEW_THREAD_REPORT_ID)); | ||
| }); | ||
|
|
||
| it('should pass isSelfTourViewed=false through to createChildReport when creating a new explain thread', async () => { |
There was a problem hiding this comment.
This test is the same as the one above. Does that mean isSelfTourViewed doesn’t affect the output?
Explanation of Change
Fixed Issues
$ #66424
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-04-14.at.22.56.22.mov