Automattic / Automattic/fresh-data

Intermittent time-based test failure

Open
#214 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
37
Forks
7
PR merge metrics
No merged PRs in 30d

Description

I've noticed an intermittent time-based test failure, which probably indicates something is getting the "now" time by default assignment instead of being explicitly assigned in the tests. Something to look into:

```
Scheduler › getNextRequestDelay › returns the same number when a new request that is scheduled later is added

expect(received).toBe(expected) // Object.is equality

Expected: 119964
Received: 119963

261 | const delayAfter = scheduler.getNextRequestDelay( now );
262 |
> 263 | expect( delayAfter ).toBe( delayBefore );
| ^
264 | } );
265 | } );
266 |

at Object.toBe (src/client/__tests__/scheduler.spec.js:263:25)

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the failing Scheduler test in src/client/__tests__/scheduler.spec.js and inspect the test around line 263, including how now is assigned. Trace the calls to getNextRequestDelay and make the test deterministic so the expected and received delays remain equal.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.