Skip to content

Commit

Permalink
Merge pull request #53720 from Expensify/nikki-remove-period
Browse files Browse the repository at this point in the history
Remove period from modified expense messages
  • Loading branch information
mjasikowski authored Dec 9, 2024
2 parents 7925c9b + aadcd50 commit 0ef4fb1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/libs/ModifiedExpenseMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ function getMessageLine(prefix: string, messageFragments: string[]): string {
return messageFragments.reduce((acc, value, index) => {
if (index === messageFragments.length - 1) {
if (messageFragments.length === 1) {
return `${acc} ${value}.`;
return `${acc} ${value}`;
}
if (messageFragments.length === 2) {
return `${acc} ${Localize.translateLocal('common.and')} ${value}.`;
return `${acc} ${Localize.translateLocal('common.and')} ${value}`;
}
return `${acc}, ${Localize.translateLocal('common.and')} ${value}.`;
return `${acc}, ${Localize.translateLocal('common.and')} ${value}`;
}
if (index === 0) {
return `${acc} ${value}`;
Expand Down
30 changes: 15 additions & 15 deletions tests/unit/ModifiedExpenseMessageTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `changed the amount to $18.00 (previously $12.55).`;
const expectedResult = `changed the amount to $18.00 (previously $12.55)`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -40,7 +40,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `set the amount to $18.00.`;
const expectedResult = `set the amount to $18.00`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -63,7 +63,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = 'changed the amount to $18.00 (previously $12.55).\nremoved the description (previously "this is for the shuttle").';
const expectedResult = 'changed the amount to $18.00 (previously $12.55)\nremoved the description (previously "this is for the shuttle")';

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -88,7 +88,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = 'changed the amount to $18.00 (previously $12.55).\nset the category to "Benefits".\nremoved the description (previously "this is for the shuttle").';
const expectedResult = 'changed the amount to $18.00 (previously $12.55)\nset the category to "Benefits"\nremoved the description (previously "this is for the shuttle")';

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -111,7 +111,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = 'changed the amount to $18.00 (previously $12.55) and the merchant to "Taco Bell" (previously "Big Belly").';
const expectedResult = 'changed the amount to $18.00 (previously $12.55) and the merchant to "Taco Bell" (previously "Big Belly")';

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand Down Expand Up @@ -139,7 +139,7 @@ describe('ModifiedExpenseMessage', () => {

it('returns the correct text message', () => {
const expectedResult =
'changed the amount to $18.00 (previously $12.55) and the merchant to "Taco Bell" (previously "Big Belly").\nset the category to "Benefits".\nremoved the description (previously "this is for the shuttle").';
'changed the amount to $18.00 (previously $12.55) and the merchant to "Taco Bell" (previously "Big Belly")\nset the category to "Benefits"\nremoved the description (previously "this is for the shuttle")';

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -165,7 +165,7 @@ describe('ModifiedExpenseMessage', () => {

it('returns the correct text message', () => {
const expectedResult =
'changed the amount to $18.00 (previously $12.55), the description to "I bought it on the way" (previously "from the business trip"), and the merchant to "Taco Bell" (previously "Big Belly").';
'changed the amount to $18.00 (previously $12.55), the description to "I bought it on the way" (previously "from the business trip"), and the merchant to "Taco Bell" (previously "Big Belly")';

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -184,7 +184,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `removed the merchant (previously "Big Belly").`;
const expectedResult = `removed the merchant (previously "Big Belly")`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -203,7 +203,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `set the merchant to "KFC".`;
const expectedResult = `set the merchant to "KFC"`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -224,7 +224,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `removed the description (previously "minishore") and the merchant (previously "Big Belly").`;
const expectedResult = `removed the description (previously "minishore") and the merchant (previously "Big Belly")`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -247,7 +247,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `removed the description (previously "minishore"), the merchant (previously "Big Belly"), and the category (previously "Benefits").`;
const expectedResult = `removed the description (previously "minishore"), the merchant (previously "Big Belly"), and the category (previously "Benefits")`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -266,7 +266,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `set the merchant to "Big Belly".`;
const expectedResult = `set the merchant to "Big Belly"`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -287,7 +287,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `set the description to "minishore" and the merchant to "Big Belly".`;
const expectedResult = `set the description to "minishore" and the merchant to "Big Belly"`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -310,7 +310,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = `set the description to "minishore", the merchant to "Big Belly", and the category to "Benefits".`;
const expectedResult = `set the description to "minishore", the merchant to "Big Belly", and the category to "Benefits"`;

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand All @@ -329,7 +329,7 @@ describe('ModifiedExpenseMessage', () => {
};

it('returns the correct text message', () => {
const expectedResult = 'changed the date to 2023-12-27 (previously 2023-12-26).';
const expectedResult = 'changed the date to 2023-12-27 (previously 2023-12-26)';

const result = ModifiedExpenseMessage.getForReportAction(report.reportID, reportAction);

Expand Down

0 comments on commit 0ef4fb1

Please sign in to comment.