Skip to content

Commit 5d1c818

Browse files
committed
Add test for no beta case
1 parent 9477f57 commit 5d1c818

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

tests/unit/ReportUtilsTest.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ describe('ReportUtils', () => {
524524
);
525525
});
526526

527-
it('should not add anything to guidedSetupData when posting into the admin room', async () => {
527+
it('should not add anything to guidedSetupData when posting into the admin room with suggestedFollowups beta', async () => {
528528
const adminsChatReportID = '1';
529529
// Not having `+` in the email allows for `isPostingTasksInAdminsRoom` flow
530530
await Onyx.merge(ONYXKEYS.SESSION, {email: 'test@example.com'});
@@ -547,6 +547,29 @@ describe('ReportUtils', () => {
547547
expect(result?.optimisticData.filter((i) => i.key === `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${adminsChatReportID}`)).toHaveLength(0);
548548
});
549549

550+
it('should add guidedSetupData when posting into admin room WITHOUT suggestedFollowups beta', async () => {
551+
const adminsChatReportID = '1';
552+
// Not having `+` in the email allows for `isPostingTasksInAdminsRoom` flow
553+
await Onyx.merge(ONYXKEYS.SESSION, {email: 'test@example.com'});
554+
// Do NOT set the suggestedFollowups beta - user should get the old task list behavior
555+
await Onyx.merge(ONYXKEYS.BETAS, []);
556+
await waitForBatchedUpdates();
557+
558+
const result = prepareOnboardingOnyxData({
559+
introSelected: undefined,
560+
engagementChoice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM,
561+
onboardingMessage: {
562+
message: 'This is a test',
563+
tasks: [{type: CONST.ONBOARDING_TASK_TYPE.CONNECT_CORPORATE_CARD, title: () => '', description: () => '', autoCompleted: false, mediaAttributes: {}}],
564+
},
565+
adminsChatReportID,
566+
selectedInterestedFeatures: ['areCompanyCardsEnabled'],
567+
companySize: CONST.ONBOARDING_COMPANY_SIZE.MICRO,
568+
});
569+
// Without the beta, tasks SHOULD be generated (old behavior)
570+
expect(result?.guidedSetupData).toHaveLength(3);
571+
});
572+
550573
it('should add guidedSetupData when email has a +', async () => {
551574
const adminsChatReportID = '1';
552575
await waitForBatchedUpdates();

0 commit comments

Comments
 (0)