Skip to content

Commit

Permalink
Merge pull request #46686 from rayane-djouah/Simplify-the-App-optimis…
Browse files Browse the repository at this point in the history
…tic-next-steps

[No QA] Polish: Update Next Steps Copy to Match Backend
  • Loading branch information
mountiny authored Aug 8, 2024
2 parents 630ed35 + d19b085 commit fdf360a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 53 deletions.
20 changes: 8 additions & 12 deletions src/libs/NextStepUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
},
{
text: 'add',
type: 'strong',
},
{
text: ' expenses.',
text: ' %expenses.',
},
],
};
Expand All @@ -119,11 +118,11 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
text: 'Waiting for ',
},
{
text: `${ownerDisplayName}`,
text: `${ownerDisplayName}'s`,
type: 'strong',
},
{
text: "'s %expenses to ",
text: ' %expenses to automatically submit',
},
];
let harvestingSuffix = '';
Expand Down Expand Up @@ -157,13 +156,12 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
};

if (harvestingSuffixes[autoReportingFrequency]) {
harvestingSuffix = ` ${harvestingSuffixes[autoReportingFrequency]}`;
harvestingSuffix = `${harvestingSuffixes[autoReportingFrequency]}`;
}
}

optimisticNextStep.message.push({
text: `automatically submit${harvestingSuffix}`,
type: 'strong',
text: ` ${harvestingSuffix}`,
});
}

Expand All @@ -188,7 +186,6 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
},
{
text: 'approve',
type: 'strong',
},
{
text: ' %expenses.',
Expand All @@ -206,7 +203,7 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
type,
message: [
{
text: 'Finished! No further action required.',
text: 'No further action required!',
},
],
};
Expand All @@ -230,7 +227,7 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
icon: CONST.NEXT_STEP.ICONS.CHECKMARK,
message: [
{
text: 'Finished! No further action required.',
text: 'No further action required!',
},
],
};
Expand All @@ -253,7 +250,6 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
},
{
text: 'pay',
type: 'strong',
},
{
text: ' %expenses.',
Expand All @@ -270,7 +266,7 @@ function buildNextStep(report: OnyxEntry<Report>, predictedNextStatus: ValueOf<t
icon: CONST.NEXT_STEP.ICONS.CHECKMARK,
message: [
{
text: 'Finished! No further action required.',
text: 'No further action required!',
},
],
};
Expand Down
69 changes: 28 additions & 41 deletions tests/unit/NextStepUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('libs/NextStepUtils', () => {
test('self review', () => {
optimisticNextStep.icon = CONST.NEXT_STEP.ICONS.HOURGLASS;

// Waiting for userSubmitter to add expenses.
// Waiting for userSubmitter to add expense(s).
optimisticNextStep.message = [
{
text: 'Waiting for ',
Expand All @@ -88,10 +88,9 @@ describe('libs/NextStepUtils', () => {
},
{
text: 'add',
type: 'strong',
},
{
text: ' expenses.',
text: ' %expenses.',
},
];

Expand All @@ -114,15 +113,14 @@ describe('libs/NextStepUtils', () => {
text: 'Waiting for ',
},
{
text: `${currentUserEmail}`,
text: `${currentUserEmail}'s`,
type: 'strong',
},
{
text: "'s %expenses to ",
text: ' %expenses to automatically submit',
},
{
text: 'automatically submit later today',
type: 'strong',
text: ' later today',
},
];

Expand All @@ -145,15 +143,14 @@ describe('libs/NextStepUtils', () => {
text: 'Waiting for ',
},
{
text: `${currentUserEmail}`,
text: `${currentUserEmail}'s`,
type: 'strong',
},
{
text: "'s %expenses to ",
text: ' %expenses to automatically submit',
},
{
text: 'automatically submit on Sunday',
type: 'strong',
text: ' on Sunday',
},
];

Expand All @@ -176,15 +173,14 @@ describe('libs/NextStepUtils', () => {
text: 'Waiting for ',
},
{
text: `${currentUserEmail}`,
text: `${currentUserEmail}'s`,
type: 'strong',
},
{
text: "'s %expenses to ",
text: ' %expenses to automatically submit',
},
{
text: 'automatically submit on the 1st and 16th of each month',
type: 'strong',
text: ' on the 1st and 16th of each month',
},
];

Expand All @@ -207,15 +203,14 @@ describe('libs/NextStepUtils', () => {
text: 'Waiting for ',
},
{
text: `${currentUserEmail}`,
text: `${currentUserEmail}'s`,
type: 'strong',
},
{
text: "'s %expenses to ",
text: ' %expenses to automatically submit',
},
{
text: 'automatically submit on the 2nd of each month',
type: 'strong',
text: ' on the 2nd of each month',
},
];

Expand All @@ -239,15 +234,14 @@ describe('libs/NextStepUtils', () => {
text: 'Waiting for ',
},
{
text: `${currentUserEmail}`,
text: `${currentUserEmail}'s`,
type: 'strong',
},
{
text: "'s %expenses to ",
text: ' %expenses to automatically submit',
},
{
text: `automatically submit on the ${format(lastDayOfMonth(new Date()), CONST.DATE.ORDINAL_DAY_OF_MONTH)} of each month`,
type: 'strong',
text: ` on the ${format(lastDayOfMonth(new Date()), CONST.DATE.ORDINAL_DAY_OF_MONTH)} of each month`,
},
];

Expand All @@ -273,15 +267,14 @@ describe('libs/NextStepUtils', () => {
text: 'Waiting for ',
},
{
text: `${currentUserEmail}`,
text: `${currentUserEmail}'s`,
type: 'strong',
},
{
text: "'s %expenses to ",
text: ' %expenses to automatically submit',
},
{
text: `automatically submit on the ${format(setDate(new Date(), lastBusinessDayOfMonth), CONST.DATE.ORDINAL_DAY_OF_MONTH)} of each month`,
type: 'strong',
text: ` on the ${format(setDate(new Date(), lastBusinessDayOfMonth), CONST.DATE.ORDINAL_DAY_OF_MONTH)} of each month`,
},
];

Expand All @@ -305,15 +298,14 @@ describe('libs/NextStepUtils', () => {
text: 'Waiting for ',
},
{
text: `${currentUserEmail}`,
text: `${currentUserEmail}'s`,
type: 'strong',
},
{
text: "'s %expenses to ",
text: ' %expenses to automatically submit',
},
{
text: `automatically submit at the end of their trip`,
type: 'strong',
text: ` at the end of their trip`,
},
];

Expand All @@ -330,7 +322,7 @@ describe('libs/NextStepUtils', () => {
});

test('manual', () => {
// Waiting for userSubmitter to add expenses.
// Waiting for userSubmitter to add expense(s).
optimisticNextStep.message = [
{
text: 'Waiting for ',
Expand All @@ -344,10 +336,9 @@ describe('libs/NextStepUtils', () => {
},
{
text: 'add',
type: 'strong',
},
{
text: ' expenses.',
text: ' %expenses.',
},
];

Expand Down Expand Up @@ -383,7 +374,6 @@ describe('libs/NextStepUtils', () => {
},
{
text: 'pay',
type: 'strong',
},
{
text: ' %expenses.',
Expand Down Expand Up @@ -413,7 +403,6 @@ describe('libs/NextStepUtils', () => {
},
{
text: 'approve',
type: 'strong',
},
{
text: ' %expenses.',
Expand Down Expand Up @@ -451,7 +440,6 @@ describe('libs/NextStepUtils', () => {
},
{
text: 'approve',
type: 'strong',
},
{
text: ' %expenses.',
Expand All @@ -475,7 +463,7 @@ describe('libs/NextStepUtils', () => {
optimisticNextStep.icon = CONST.NEXT_STEP.ICONS.CHECKMARK;
optimisticNextStep.message = [
{
text: 'Finished! No further action required.',
text: 'No further action required!',
},
];

Expand All @@ -495,7 +483,7 @@ describe('libs/NextStepUtils', () => {
optimisticNextStep.icon = CONST.NEXT_STEP.ICONS.CHECKMARK;
optimisticNextStep.message = [
{
text: 'Finished! No further action required.',
text: 'No further action required!',
},
];

Expand All @@ -521,7 +509,6 @@ describe('libs/NextStepUtils', () => {
},
{
text: 'pay',
type: 'strong',
},
{
text: ' %expenses.',
Expand All @@ -547,7 +534,7 @@ describe('libs/NextStepUtils', () => {
optimisticNextStep.icon = CONST.NEXT_STEP.ICONS.CHECKMARK;
optimisticNextStep.message = [
{
text: 'Finished! No further action required.',
text: 'No further action required!',
},
];

Expand Down

0 comments on commit fdf360a

Please sign in to comment.