Skip to content

Commit 9477f57

Browse files
committed
fix tests
1 parent 44e2fef commit 9477f57

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/libs/ReportUtils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import SCREENS from '@src/SCREENS';
3737
import type {
3838
BankAccountList,
3939
Beta,
40+
BetaConfiguration,
4041
IntroSelected,
4142
OnyxInputOrEntry,
4243
OutstandingReportsByPolicyIDDerivedValue,
@@ -1115,6 +1116,12 @@ Onyx.connectWithoutView({
11151116
callback: (value) => (allBetas = value),
11161117
});
11171118

1119+
let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
1120+
Onyx.connectWithoutView({
1121+
key: ONYXKEYS.BETA_CONFIGURATION,
1122+
callback: (value) => (betaConfiguration = value ?? {}),
1123+
});
1124+
11181125
let allTransactions: OnyxCollection<Transaction> = {};
11191126
let reportsTransactions: Record<string, Transaction[]> = {};
11201127
Onyx.connectWithoutView({
@@ -11581,7 +11588,7 @@ function prepareOnboardingOnyxData({
1158111588
// Guides are assigned and tasks are posted in the #admins room for the MANAGE_TEAM and TRACK_WORKSPACE onboarding actions, except for emails that have a '+'.
1158211589
const shouldPostTasksInAdminsRoom = isPostingTasksInAdminsRoom(engagementChoice);
1158311590
// When posting to admins room and the user is in the suggestedFollowups beta, we skip tasks in favor of backend-generated followups.
11584-
const shouldUseFollowupsInsteadOfTasks = shouldPostTasksInAdminsRoom && Permissions.isBetaEnabled(CONST.BETAS.SUGGESTED_FOLLOWUPS, allBetas);
11591+
const shouldUseFollowupsInsteadOfTasks = shouldPostTasksInAdminsRoom && Permissions.isBetaEnabled(CONST.BETAS.SUGGESTED_FOLLOWUPS, allBetas, betaConfiguration);
1158511592
const adminsChatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`];
1158611593
const targetChatReport = shouldPostTasksInAdminsRoom
1158711594
? (adminsChatReport ?? {reportID: adminsChatReportID, policyID: onboardingPolicyID})

tests/actions/PolicyTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ describe('actions/Policy', () => {
6363
await Onyx.set(`${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, fakePolicy);
6464
await Onyx.set(`${ONYXKEYS.NVP_ACTIVE_POLICY_ID}`, fakePolicy.id);
6565
await Onyx.set(`${ONYXKEYS.NVP_INTRO_SELECTED}`, {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM});
66+
// Enable the suggestedFollowups beta so tasks are skipped in favor of backend-generated followups
67+
await Onyx.set(ONYXKEYS.BETAS, [CONST.BETAS.SUGGESTED_FOLLOWUPS]);
6668
await waitForBatchedUpdates();
6769

6870
let adminReportID;

tests/unit/ReportUtilsTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@ describe('ReportUtils', () => {
528528
const adminsChatReportID = '1';
529529
// Not having `+` in the email allows for `isPostingTasksInAdminsRoom` flow
530530
await Onyx.merge(ONYXKEYS.SESSION, {email: 'test@example.com'});
531+
// Enable the suggestedFollowups beta so tasks are skipped in favor of backend-generated followups
532+
await Onyx.merge(ONYXKEYS.BETAS, [CONST.BETAS.SUGGESTED_FOLLOWUPS]);
531533
await waitForBatchedUpdates();
532534

533535
const result = prepareOnboardingOnyxData({

0 commit comments

Comments
 (0)