Skip to content

Commit dd06940

Browse files
test: replace Date.now() with fixed timestamps in tests
Addresses flaky test detection bot J7 pattern (non-deterministic data). Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 2d0353c commit dd06940

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/components/UI/AssetOverview/PriceChart/PriceChart.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,10 @@ describe('PriceChart', () => {
258258
* Synthetic responder event with the touchHistory shape
259259
* that PanResponder's internal state machine expects.
260260
*/
261+
const FIXED_TIMESTAMP = 1_736_761_237_983;
262+
261263
const createResponderEvent = (locationX: number, locationY: number) => {
262-
const timestamp = Date.now();
264+
const timestamp = FIXED_TIMESTAMP;
263265
return {
264266
nativeEvent: {
265267
locationX,

app/components/hooks/useTokenHistoricalPrices.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function makeTimeSeries(
1818
}
1919

2020
describe('hasInsufficientTimeCoverage', () => {
21-
const now = Date.now();
21+
const now = 1_000_000_000_000;
2222

2323
it('returns false for "all" time period (no expected duration)', () => {
2424
const prices = makeTimeSeries(now, 10, HOUR_MS);

0 commit comments

Comments
 (0)