Skip to content

Commit 1d83e25

Browse files
authored
Merge branch 'main' into rn-upgrade/0.81.5-no-unit-tests
2 parents 6cd22b9 + 34f3d4c commit 1d83e25

5 files changed

Lines changed: 14 additions & 25 deletions

File tree

.github/workflows/update-e2e-fixtures.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ jobs:
255255
run: |
256256
IS_TEST='true' NODE_OPTIONS='--experimental-vm-modules' \
257257
yarn detox test -c ios.sim.main.ci --headless \
258-
tests/regression/fixtures/fixture-validation.spec.ts
258+
tests/smoke/fixtures/fixture-validation.spec.ts
259259
env:
260260
PREBUILT_IOS_APP_PATH: artifacts/main-qa-MetaMask.app
261261

app/components/UI/Rewards/components/Campaigns/CampaignTile.utils.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jest.mock('@metamask/design-system-react-native', () => ({
2323
}));
2424

2525
jest.mock('../../../../../../locales/i18n', () => ({
26+
__esModule: true,
27+
default: { locale: 'en-US' },
2628
strings: jest.fn((key: string, params?: Record<string, string>) =>
2729
params ? `${key}:${JSON.stringify(params)}` : key,
2830
),

app/components/UI/Rewards/components/Campaigns/CampaignTile.utils.ts

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
type CampaignDto,
55
type CampaignStatus,
66
} from '../../../../../core/Engine/controllers/rewards-controller/types';
7-
import { strings } from '../../../../../../locales/i18n';
7+
import I18n, { strings } from '../../../../../../locales/i18n';
8+
import { getIntlDateTimeFormatter } from '../../../../../util/intl';
89

910
/**
1011
* Set of campaign types that have full UI support (details view, opt-in, etc.)
@@ -53,32 +54,18 @@ export function getCampaignStatus(campaign: CampaignDto): CampaignStatus {
5354
return 'complete';
5455
}
5556

56-
const MONTHS = [
57-
'January',
58-
'February',
59-
'March',
60-
'April',
61-
'May',
62-
'June',
63-
'July',
64-
'August',
65-
'September',
66-
'October',
67-
'November',
68-
'December',
69-
];
70-
7157
/**
72-
* Formats a date for display in campaign tiles.
58+
* Formats a date for display in campaign tiles (localized month and day).
7359
*
7460
* @param date - The date to format
75-
* @returns Formatted date string (e.g., "March 15")
61+
* @param locale - BCP 47 locale; defaults to the app locale
62+
* @returns Formatted date string (e.g., "March 15" in en-US)
7663
*/
77-
function formatCampaignDate(date: Date): string {
78-
const month = MONTHS[date.getMonth()];
79-
const day = date.getDate();
80-
81-
return `${month} ${day}`;
64+
function formatCampaignDate(date: Date, locale: string = I18n.locale): string {
65+
return getIntlDateTimeFormatter(locale, {
66+
month: 'long',
67+
day: 'numeric',
68+
}).format(date);
8269
}
8370

8471
/**

tests/scripts/update-e2e-fixture.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ TARGET_FILE="tests/framework/fixtures/json/default-fixture.json"
1010
if [ ! -f "$REPORT_FILE" ]; then
1111
echo "Error: $REPORT_FILE not found."
1212
echo "Run the fixture validation test first:"
13-
echo " yarn detox test tests/regression/fixtures/fixture-validation.spec.ts -c <config>"
13+
echo " yarn detox test tests/smoke/fixtures/fixture-validation.spec.ts -c <config>"
1414
exit 1
1515
fi
1616

File renamed without changes.

0 commit comments

Comments
 (0)