Skip to content

Commit 99d004a

Browse files
committed
F
1 parent f24547a commit 99d004a

File tree

4 files changed

+77
-40
lines changed

4 files changed

+77
-40
lines changed

app/components/UI/Rewards/components/Tabs/ActivityTab/ActivityEventRow.test.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@ jest.mock('../../../utils/formatUtils', () => ({
1616
formatNumber: jest
1717
.fn()
1818
.mockImplementation((value) => value?.toString() || '0'),
19-
formatRewardsMusdDepositPayloadDate: jest.fn((isoDate: string) => {
20-
// Mock implementation that formats the date
21-
const date = new Date(`${isoDate}T00:00:00Z`);
22-
return new Intl.DateTimeFormat('en-US', {
23-
year: 'numeric',
24-
month: 'short',
25-
day: 'numeric',
26-
timeZone: 'UTC',
27-
}).format(date);
28-
}),
19+
formatRewardsMusdDepositPayloadDate: jest.fn(
20+
(isoDate: string | undefined) => {
21+
// Mock implementation that matches the real implementation behavior
22+
if (
23+
!isoDate ||
24+
typeof isoDate !== 'string' ||
25+
!/^\d{4}-\d{2}-\d{2}$/.test(isoDate)
26+
) {
27+
return null;
28+
}
29+
const date = new Date(`${isoDate}T00:00:00Z`);
30+
return new Intl.DateTimeFormat('en-US', {
31+
year: 'numeric',
32+
month: 'short',
33+
day: 'numeric',
34+
timeZone: 'UTC',
35+
}).format(date);
36+
},
37+
),
2938
}));
3039

3140
jest.mock('../../../utils/eventDetailsUtils', () => ({

app/components/UI/Rewards/components/Tabs/ActivityTab/EventDetails/ActivityDetailsSheet.test.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,25 @@ jest.mock('../../../../../../../../locales/i18n', () => ({
4747
jest.mock('../../../../utils/formatUtils', () => ({
4848
formatRewardsDate: jest.fn(() => 'Sep 9, 2025'),
4949
formatNumber: jest.fn((n: number) => n.toString()),
50-
formatRewardsMusdDepositPayloadDate: jest.fn((isoDate: string) => {
51-
// Mock implementation that formats the date
52-
const date = new Date(`${isoDate}T00:00:00Z`);
53-
return new Intl.DateTimeFormat('en-US', {
54-
year: 'numeric',
55-
month: 'short',
56-
day: 'numeric',
57-
timeZone: 'UTC',
58-
}).format(date);
59-
}),
50+
formatRewardsMusdDepositPayloadDate: jest.fn(
51+
(isoDate: string | undefined) => {
52+
// Mock implementation that matches the real implementation behavior
53+
if (
54+
!isoDate ||
55+
typeof isoDate !== 'string' ||
56+
!/^\d{4}-\d{2}-\d{2}$/.test(isoDate)
57+
) {
58+
return null;
59+
}
60+
const date = new Date(`${isoDate}T00:00:00Z`);
61+
return new Intl.DateTimeFormat('en-US', {
62+
year: 'numeric',
63+
month: 'short',
64+
day: 'numeric',
65+
timeZone: 'UTC',
66+
}).format(date);
67+
},
68+
),
6069
}));
6170

6271
// Mock eventDetailsUtils

app/components/UI/Rewards/components/Tabs/ActivityTab/EventDetails/MusdDepositEventDetails.test.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,25 @@ jest.mock('../../../../../../../../locales/i18n', () => ({
3434
jest.mock('../../../../utils/formatUtils', () => ({
3535
formatRewardsDate: jest.fn(() => 'Sep 9, 2025'),
3636
formatNumber: jest.fn((n: number) => n.toString()),
37-
formatRewardsMusdDepositPayloadDate: jest.fn((isoDate: string) => {
38-
// Mock implementation that formats the date
39-
const date = new Date(`${isoDate}T00:00:00Z`);
40-
return new Intl.DateTimeFormat('en-US', {
41-
year: 'numeric',
42-
month: 'short',
43-
day: 'numeric',
44-
timeZone: 'UTC',
45-
}).format(date);
46-
}),
37+
formatRewardsMusdDepositPayloadDate: jest.fn(
38+
(isoDate: string | undefined) => {
39+
// Mock implementation that matches the real implementation behavior
40+
if (
41+
!isoDate ||
42+
typeof isoDate !== 'string' ||
43+
!/^\d{4}-\d{2}-\d{2}$/.test(isoDate)
44+
) {
45+
return null;
46+
}
47+
const date = new Date(`${isoDate}T00:00:00Z`);
48+
return new Intl.DateTimeFormat('en-US', {
49+
year: 'numeric',
50+
month: 'short',
51+
day: 'numeric',
52+
timeZone: 'UTC',
53+
}).format(date);
54+
},
55+
),
4756
}));
4857

4958
// Mock SVG used in the component to avoid native rendering issues

app/components/UI/Rewards/utils/eventDetailsUtils.test.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,26 @@ jest.mock('../../../../../locales/i18n', () => ({
5050
// Mock formatUtils
5151
jest.mock('./formatUtils', () => ({
5252
formatNumber: jest.fn((value: number) => value.toString()),
53-
formatRewardsMusdDepositPayloadDate: jest.fn((isoDate: string) => {
54-
// Mock implementation that formats the date
55-
const date = new Date(`${isoDate}T00:00:00Z`);
56-
return new Intl.DateTimeFormat('en-US', {
57-
year: 'numeric',
58-
month: 'short',
59-
day: 'numeric',
60-
timeZone: 'UTC',
61-
}).format(date);
62-
}),
53+
formatRewardsMusdDepositPayloadDate: jest.fn(
54+
(isoDate: string | undefined) => {
55+
// Mock implementation that matches the real implementation behavior
56+
if (
57+
!isoDate ||
58+
typeof isoDate !== 'string' ||
59+
!/^\d{4}-\d{2}-\d{2}$/.test(isoDate)
60+
) {
61+
return null;
62+
}
63+
// Mock implementation that formats the date
64+
const date = new Date(`${isoDate}T00:00:00Z`);
65+
return new Intl.DateTimeFormat('en-US', {
66+
year: 'numeric',
67+
month: 'short',
68+
day: 'numeric',
69+
timeZone: 'UTC',
70+
}).format(date);
71+
},
72+
),
6373
}));
6474

6575
describe('eventDetailsUtils', () => {

0 commit comments

Comments
 (0)