From b226fa820aeb25ca7a1a6571f3b3fe384b87dd39 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Tue, 10 Nov 2026 21:19:33 -0800 Subject: [PATCH] test(news): briefing stories share one published time, so their order never depends on a clock tick --- src/ui/cockpitBriefing.test.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/cockpitBriefing.test.mjs b/src/ui/cockpitBriefing.test.mjs index a97059aaa..78f2cbdae 100644 --- a/src/ui/cockpitBriefing.test.mjs +++ b/src/ui/cockpitBriefing.test.mjs @@ -171,11 +171,15 @@ test('regional news and local conditions render what the region returned', async assert.equal(text('#cockpit-local-coordinates'), 'POSITION UNAVAILABLE'); }); +// One time for every story: newest-first order then keeps the order a test +// lists them in. A clock read per story could tick between two of them and +// swap them. +const STORY_PUBLISHED_AT = new Date().toISOString(); const story = (id, url = `https://example.com/${id}`) => ({ url, title: `Story ${id}`, domain: 'example.com', - publishedAt: new Date().toISOString(), + publishedAt: STORY_PUBLISHED_AT, }); test('a refreshed news list keeps a focused story on its own link', async (t) => {