Fix flaky mtime assertion in the static party store test on Linux
Some checks failed
Publier l'image Docker / test (pull_request) Failing after 3s
Publier l'image Docker / publish (pull_request) Has been skipped

The "only rewrites the party that changed" test compared a file's
mtimeMs against the exact millisecond passed to utimesSync. Linux
reports mtimeMs as a float that can land a hair off it (...780.999 for
...781), failing CI on master. Compare against the mtime the filesystem
reports right after setting it instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Nicolas 2026-09-24 19:36:21 +02:00
parent db3cf68843
commit b0d2100210

View file

@ -195,11 +195,15 @@ describe('StaticPartyStore', () => {
const otherFile = path.join(partiesDir(), `${other.id}.json`); const otherFile = path.join(partiesDir(), `${other.id}.json`);
const past = new Date(Date.now() - 60000); const past = new Date(Date.now() - 60000);
fs.utimesSync(otherFile, past, past); fs.utimesSync(otherFile, past, past);
// Compared against what the filesystem itself reports back, not
// past.getTime(): Linux returns mtimeMs as a float that can land a
// hair off the exact millisecond set (e.g. ...780.999 for ...781).
const mtimeBefore = fs.statSync(otherFile).mtimeMs;
StaticPartyService.markWatched(sp, alice, 'e1'); StaticPartyService.markWatched(sp, alice, 'e1');
await StaticPartyStore.writeNow(); await StaticPartyStore.writeNow();
assert.equal(fs.statSync(otherFile).mtimeMs, past.getTime(), 'the untouched party\'s file was not rewritten'); assert.equal(fs.statSync(otherFile).mtimeMs, mtimeBefore, 'the untouched party\'s file was not rewritten');
}); });
it('deleting a party removes its file, even with a save still pending', async () => { it('deleting a party removes its file, even with a save still pending', async () => {