Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8f8c69c
fix: refactor completeOnboarding
truph01 Jun 11, 2026
3c92305
fix: add test
truph01 Jun 11, 2026
6830d02
fix: use reports instead of deprecatedAllReports
truph01 Jun 11, 2026
5816f8d
fix: add test
truph01 Jun 11, 2026
5e05fbe
fix: add test
truph01 Jun 11, 2026
bf66b16
Merge branch 'Expensify:main' into fix/66416-part-5
truph01 Jun 16, 2026
69dd980
fix: don't pass entire reports data to prepareOnboardingOnyxData
truph01 Jun 16, 2026
3f60cdc
Merge branch 'Expensify:main' into fix/66416-part-5
truph01 Jun 19, 2026
051acea
merge main
truph01 Jun 22, 2026
882f648
fix: conflicts
truph01 Jun 22, 2026
51a9f8e
fix: conflicts
truph01 Jun 23, 2026
e555959
fix: conflicts
truph01 Jun 23, 2026
8b0f233
fix: conflicts
truph01 Jun 23, 2026
f5bf27d
fix: lint
truph01 Jun 23, 2026
d416b10
fix: remove redundant subscribe
truph01 Jun 23, 2026
018c0c6
fix: only pass necessary report params
truph01 Jun 23, 2026
f1825ac
fix: conflicts
truph01 Jun 23, 2026
ddf10b3
Merge branch 'Expensify:main' into fix/66416-part-5
truph01 Jun 23, 2026
e427691
Merge branch 'Expensify:main' into fix/66416-part-5
truph01 Jun 24, 2026
f5ca257
Merge branch 'main' into fix/66416-part-5
truph01 Jun 25, 2026
0bcceec
Merge branch 'Expensify:main' into fix/66416-part-5
truph01 Jun 29, 2026
80fb674
Update src/hooks/useAutoCreateSubmitWorkspace.ts
truph01 Jun 29, 2026
c7ffa68
Update src/pages/OnboardingInterestedFeatures/BaseOnboardingIntereste…
truph01 Jun 29, 2026
12921ee
Update src/pages/OnboardingWorkspaces/BaseOnboardingWorkspaces.tsx
truph01 Jun 29, 2026
2343286
Update src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx
truph01 Jun 29, 2026
f4e82f9
Update src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDeta…
truph01 Jun 29, 2026
de2754e
Update src/hooks/useAutoCreateTrackWorkspace.ts
truph01 Jun 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/hooks/useAutoCreateSubmitWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function useAutoCreateSubmitWorkspace() {
[],
);
const [hasEditableGroupPolicy] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: groupPolicySelector});
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);

const autoCreateSubmitWorkspace = useCallback(
async (firstName: string, lastName: string) => {
Expand Down Expand Up @@ -82,6 +84,7 @@ function useAutoCreateSubmitWorkspace() {
onboardingPolicyID: newPolicyID,
introSelected,
isSelfTourViewed,
conciergeChat,
});
} catch (error) {
Log.warn('[useAutoCreateSubmitWorkspace] Error completing onboarding', {error});
Expand Down Expand Up @@ -110,6 +113,7 @@ function useAutoCreateSubmitWorkspace() {
betas,
hasActiveAdminPolicies,
shouldUseNarrowLayout,
conciergeChat,
],
);

Expand Down
7 changes: 7 additions & 0 deletions src/hooks/useAutoCreateTrackWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ function useAutoCreateTrackWorkspace() {
const [hasPaidGroupAdminPolicy] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: paidGroupPolicySelector});

const [conciergeChatReportID = ''] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeChatReportID}`);
const [selfDMReportID] = useOnyx(ONYXKEYS.SELF_DM_REPORT_ID);
const [selfDMReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`);
const [onboardingValues] = useOnyx(ONYXKEYS.NVP_ONBOARDING);
const [reportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS);
const {isBetaEnabled} = usePermissions();
Expand Down Expand Up @@ -104,6 +107,8 @@ function useAutoCreateTrackWorkspace() {
personalTrackGoal: onboardingPurposeSelected === CONST.ONBOARDING_CHOICES.TRACK_PERSONAL && !!personalTrackGoal ? personalTrackGoal : undefined,
introSelected,
isSelfTourViewed,
conciergeChat,
selfDMReport,
Comment on lines +110 to +111

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this place, I notice
const engagementChoice: "newDotTrackWorkspace" | "newDotTrackPersonalWorkspace"
Could we eliminate any parameter? Please go through all the places to ensure there are no redundant params

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DylanDylann I resolved your comment

});

if (isSidePanelReportSupported) {
Expand Down Expand Up @@ -156,6 +161,8 @@ function useAutoCreateTrackWorkspace() {
conciergeChatReportID,
reportNameValuePairs,
mergedAccountConciergeReportID,
conciergeChat,
selfDMReport,
],
);

Expand Down
17 changes: 14 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11554,6 +11554,12 @@ type PrepareOnboardingOnyxDataParams = {
onboardingPurposeSelected?: OnboardingPurpose;
// TODO: isSelfTourViewed will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424
isSelfTourViewed?: boolean;
/** The concierge chat report, looked up by conciergeReportID. Falls back to getChatByParticipants using the deprecated module-level Onyx data while the refactor is in progress. */
conciergeChat?: OnyxEntry<Report>;
/** The admins chat report, looked up by adminsChatReportID. Falls back to the deprecated module-level Onyx data while the refactor is in progress. */
adminsChatReport?: OnyxEntry<Report>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A boolean flag should be enough. I’d prefer to avoid passing a large object unnecessarily.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can use a selector here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A boolean flag should be enough. I’d prefer to avoid passing a large object unnecessarily.

@DylanDylann What do you mean by using "boolean flag" here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, let's ignore this

/** The self-DM report, looked up by ONYXKEYS.SELF_DM_REPORT_ID. Falls back to the deprecated module-level Onyx data while the refactor is in progress. */
selfDMReport?: OnyxEntry<Report>;
};

function prepareOnboardingOnyxData({
Expand All @@ -11568,6 +11574,9 @@ function prepareOnboardingOnyxData({
isInvitedAccountant,
onboardingPurposeSelected,
isSelfTourViewed,
conciergeChat: conciergeChatParam,
adminsChatReport: adminsChatReportParam,
selfDMReport: selfDMReportParam,
}: PrepareOnboardingOnyxDataParams) {
if (engagementChoice === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND) {
// eslint-disable-next-line no-param-reassign
Expand All @@ -11582,8 +11591,9 @@ function prepareOnboardingOnyxData({
const shouldPostTasksInAdminsRoom = isPostingTasksInAdminsRoom(engagementChoice);
// Server picks the inboxAdminsBespoke variant at response time, so optimistic writes here would be stale.
const shouldDeferOptimisticTasks = engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM;
const adminsChatReport = deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`];
const adminsChatReport = adminsChatReportParam ?? deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`];
const conciergeChat =
conciergeChatParam ??
getChatByParticipants([CONST.ACCOUNT_ID.CONCIERGE, deprecatedCurrentUserAccountID ?? CONST.DEFAULT_NUMBER_ID], deprecatedAllReports, false) ??
(conciergeReportIDOnyxConnect ? {reportID: conciergeReportIDOnyxConnect} : undefined);
const targetChatReport = shouldPostTasksInAdminsRoom
Expand Down Expand Up @@ -11977,7 +11987,8 @@ function prepareOnboardingOnyxData({
lastVisibleActionCreated: '',
hasOutstandingChildTask: false,
};
const report = deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${targetChatReportID}`];
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- targetChatReport may be a stub with only reportID/policyID/chatType; the consumers below handle missing fields gracefully.
const report = targetChatReport as OnyxEntry<Report>;
const canUserPerformWriteActionVariable = canUserPerformWriteAction(report, false);
const {lastMessageText = ''} = getLastVisibleMessageActionUtils(targetChatReportID, canUserPerformWriteActionVariable);
if (lastMessageText) {
Expand Down Expand Up @@ -12088,7 +12099,7 @@ function prepareOnboardingOnyxData({
(!onboardingPurposeSelected || onboardingPurposeSelected === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND || onboardingPurposeSelected === CONST.ONBOARDING_CHOICES.TRACK_PERSONAL))
) {
const selfDMReportID = findSelfDMReportID();
let selfDMReport = deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`];
let selfDMReport = selfDMReportParam ?? deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`];
let createdAction: ReportAction;
if (!selfDMReport) {
const currentTime = DateUtils.getDBTime();
Expand Down
12 changes: 12 additions & 0 deletions src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5438,6 +5438,12 @@ type CompleteOnboardingProps = {
shouldWaitForRHPVariantInitialization?: boolean;
introSelected: OnyxEntry<IntroSelected>;
isSelfTourViewed: boolean | undefined;
/** The concierge chat report, looked up by ONYXKEYS.CONCIERGE_REPORT_ID. */
conciergeChat?: OnyxEntry<Report>;
/** The admins chat report, looked up by ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_ID. */
adminsChatReport?: OnyxEntry<Report>;
/** The self-DM report, looked up by ONYXKEYS.SELF_DM_REPORT_ID. */
selfDMReport?: OnyxEntry<Report>;
};

async function completeOnboarding({
Expand All @@ -5458,6 +5464,9 @@ async function completeOnboarding({
shouldWaitForRHPVariantInitialization = false,
introSelected,
isSelfTourViewed,
conciergeChat,
adminsChatReport,
selfDMReport,
}: CompleteOnboardingProps) {
const onboardingData = prepareOnboardingOnyxData({
introSelected,
Expand All @@ -5471,6 +5480,9 @@ async function completeOnboarding({
isInvitedAccountant,
onboardingPurposeSelected,
isSelfTourViewed,
conciergeChat,
adminsChatReport,
selfDMReport,
});
if (!onboardingData) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
const {isBetaEnabled} = usePermissions();
const [session] = useOnyx(ONYXKEYS.SESSION);
const [conciergeReportID = ''] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);
const [adminsChatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${onboardingAdminsChatReportID}`);
const [reportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS);
const activePolicy = useActivePolicy();
const hasActiveAdminPolicies = useHasActiveAdminPolicies();
Expand Down Expand Up @@ -235,6 +237,8 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
shouldWaitForRHPVariantInitialization: isSidePanelReportSupported,
introSelected,
isSelfTourViewed,
conciergeChat,
adminsChatReport,
});
const rhpVariant = isSidePanelReportSupported ? extractRHPVariantFromResponse(response) : undefined;

Expand Down Expand Up @@ -292,6 +296,8 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
hasActiveAdminPolicies,
lastWorkspaceNumber,
translate,
conciergeChat,
adminsChatReport,
]);

// Create items for enabled features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
const [loginList] = useOnyx(ONYXKEYS.LOGINS, {selector: expensifyLoginsSelector});
const [onboardingValues] = useOnyx(ONYXKEYS.NVP_ONBOARDING);
const [conciergeChatReportID = ''] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeChatReportID}`);
const {onboardingMessages} = useOnboardingMessages();
const [session] = useOnyx(ONYXKEYS.SESSION);
const [onboardingPersonalDetailsForm] = useOnyx(ONYXKEYS.FORMS.ONBOARDING_PERSONAL_DETAILS_FORM);
Expand Down Expand Up @@ -97,6 +98,7 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
onboardingPolicyID,
introSelected,
isSelfTourViewed,
conciergeChat,
});

setOnboardingAdminsChatReportID();
Expand Down Expand Up @@ -130,6 +132,7 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
conciergeChatReportID,
introSelected,
isSelfTourViewed,
conciergeChat,
],
);

Expand Down
5 changes: 5 additions & 0 deletions src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ function BaseOnboardingPurpose({shouldUseNativeStyles, shouldEnableMaxHeight, ro
const {onboardingIsMediumOrLargerScreenWidth} = useResponsiveLayout();
const onboardingStep = useOnboardingStepCounter(SCREENS.ONBOARDING.PURPOSE);
const [account] = useOnyx(ONYXKEYS.ACCOUNT);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);
const {onboardingMessages} = useOnboardingMessages();

const isPrivateDomainAndHasAccessiblePolicies = !account?.isFromPublicDomain && !!account?.hasAccessibleDomainPolicies;
Expand All @@ -72,6 +74,7 @@ function BaseOnboardingPurpose({shouldUseNativeStyles, shouldEnableMaxHeight, ro
const [onboardingErrorMessage, onboardingErrorMessageResult] = useOnyx(ONYXKEYS.ONBOARDING_ERROR_MESSAGE_TRANSLATION_KEY);
const [onboardingPolicyID] = useOnyx(ONYXKEYS.ONBOARDING_POLICY_ID);
const [onboardingAdminsChatReportID] = useOnyx(ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_ID);
const [adminsChatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${onboardingAdminsChatReportID}`);
const [personalDetailsForm] = useOnyx(ONYXKEYS.FORMS.ONBOARDING_PERSONAL_DETAILS_FORM);
const [onboardingCompanySize] = useOnyx(ONYXKEYS.ONBOARDING_COMPANY_SIZE);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
Expand Down Expand Up @@ -137,6 +140,8 @@ function BaseOnboardingPurpose({shouldUseNativeStyles, shouldEnableMaxHeight, ro
companySize: onboardingCompanySize,
introSelected,
isSelfTourViewed,
conciergeChat,
adminsChatReport,
});

return;
Expand Down
2 changes: 2 additions & 0 deletions src/pages/OnboardingWorkspaces/BaseOnboardingWorkspaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function BaseOnboardingWorkspaces({route, shouldUseNativeStyles}: BaseOnboarding

const {isBetaEnabled} = usePermissions();
const [conciergeReportID = ''] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);

const [onboardingValues] = useOnyx(ONYXKEYS.NVP_ONBOARDING);
const isVsb = onboardingValues?.signupQualifier === CONST.ONBOARDING_SIGNUP_QUALIFIERS.VSB;
Expand Down Expand Up @@ -93,6 +94,7 @@ function BaseOnboardingWorkspaces({route, shouldUseNativeStyles}: BaseOnboarding
companySize: onboardingCompanySize,
introSelected,
isSelfTourViewed,
conciergeChat,
});
setOnboardingAdminsChatReportID();
setOnboardingPolicyID(policy.policyID);
Expand Down
115 changes: 115 additions & 0 deletions tests/actions/ReportTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2898,6 +2898,121 @@ describe('actions/Report', () => {
const formEntries = Object.fromEntries(body as FormData);
expect(formEntries.selectedInterestedFeatures).toBe(JSON.stringify(selectedInterestedFeatures));
});

it('should post onboarding tasks to the existing Concierge chat', async () => {
await Onyx.set(ONYXKEYS.SESSION, {email: TEST_USER_LOGIN, accountID: TEST_USER_ACCOUNT_ID});
await waitForBatchedUpdates();

// An existing 1:1 Concierge chat the onboarding tasks should be posted to
const conciergeChatReportID = '9988776655';
const conciergeChat: OnyxTypes.Report = {
reportID: conciergeChatReportID,
type: CONST.REPORT.TYPE.CHAT,
participants: {
[CONST.ACCOUNT_ID.CONCIERGE]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS},
[TEST_USER_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS},
},
};
// LOOKING_AROUND posts the onboarding tasks to the Concierge chat (not the #admins room)
const engagementChoice = CONST.ONBOARDING_CHOICES.LOOKING_AROUND;
const {onboardingMessages} = getOnboardingMessages();

const onboardingData = ReportUtils.prepareOnboardingOnyxData({
engagementChoice,
onboardingMessage: onboardingMessages[engagementChoice],
companySize: CONST.ONBOARDING_COMPANY_SIZE.MICRO,
userReportedIntegration: null,
introSelected: {choice: engagementChoice},
isSelfTourViewed: false,
conciergeChat,
});

// The onboarding optimistic data should target the existing Concierge chat
expect(onboardingData).toBeTruthy();
const targetsConciergeChat = onboardingData?.optimisticData.some((update) => update.key.includes(conciergeChatReportID));
expect(targetsConciergeChat).toBe(true);
});

it('should reuse the existing self-DM for a personal spend onboarding', async () => {
await Onyx.set(ONYXKEYS.SESSION, {email: TEST_USER_LOGIN, accountID: TEST_USER_ACCOUNT_ID});
await waitForBatchedUpdates();

// An existing Concierge chat (the onboarding target) and an existing self-DM the personal spend
// onboarding should reuse instead of creating a new one
const conciergeChatReportID = '6677889900';
const conciergeChat: OnyxTypes.Report = {
reportID: conciergeChatReportID,
type: CONST.REPORT.TYPE.CHAT,
participants: {
[CONST.ACCOUNT_ID.CONCIERGE]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS},
[TEST_USER_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS},
},
};
const selfDMReportID = '5544332211';
const selfDMReport: OnyxTypes.Report = {
reportID: selfDMReportID,
type: CONST.REPORT.TYPE.CHAT,
chatType: CONST.REPORT.CHAT_TYPE.SELF_DM,
participants: {
[TEST_USER_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS},
},
};
await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${selfDMReportID}`, selfDMReport);
await waitForBatchedUpdates();

// PERSONAL_SPEND routes the onboarding to the user's self-DM
const engagementChoice = CONST.ONBOARDING_CHOICES.PERSONAL_SPEND;
const {onboardingMessages} = getOnboardingMessages();

const onboardingData = ReportUtils.prepareOnboardingOnyxData({
engagementChoice,
onboardingMessage: onboardingMessages[engagementChoice],
companySize: CONST.ONBOARDING_COMPANY_SIZE.MICRO,
userReportedIntegration: null,
introSelected: {choice: engagementChoice},
isSelfTourViewed: false,
conciergeChat,
});

// The existing self-DM should be reused, so no new self-DM is created
expect(onboardingData).toBeTruthy();
expect(onboardingData?.selfDMParameters?.reportID).toBeUndefined();
});

it('should optimistically create a self-DM for a personal spend onboarding when none exists', async () => {
await Onyx.set(ONYXKEYS.SESSION, {email: TEST_USER_LOGIN, accountID: TEST_USER_ACCOUNT_ID});
await waitForBatchedUpdates();

// Only a Concierge chat exists (the onboarding target); there is no self-DM yet
const conciergeChatReportID = '1122334455';
const conciergeChat: OnyxTypes.Report = {
reportID: conciergeChatReportID,
type: CONST.REPORT.TYPE.CHAT,
participants: {
[CONST.ACCOUNT_ID.CONCIERGE]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS},
[TEST_USER_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS},
},
};
const engagementChoice = CONST.ONBOARDING_CHOICES.PERSONAL_SPEND;
const {onboardingMessages} = getOnboardingMessages();

const onboardingData = ReportUtils.prepareOnboardingOnyxData({
engagementChoice,
onboardingMessage: onboardingMessages[engagementChoice],
companySize: CONST.ONBOARDING_COMPANY_SIZE.MICRO,
userReportedIntegration: null,
introSelected: {choice: engagementChoice},
isSelfTourViewed: false,
conciergeChat,
});

// A new self-DM is created and added to the optimistic data
expect(onboardingData).toBeTruthy();
const newSelfDMReportID = onboardingData?.selfDMParameters?.reportID;
expect(newSelfDMReportID).toBeTruthy();
const createsSelfDM = onboardingData?.optimisticData.some((update) => update.key === `${ONYXKEYS.COLLECTION.REPORT}${newSelfDMReportID}`);
expect(createsSelfDM).toBe(true);
});
});

describe('markAllMessagesAsRead', () => {
Expand Down
Loading