diff --git a/apps/api/src/links/links.service.db.test.ts b/apps/api/src/links/links.service.db.test.ts index cc77b21..5114db0 100644 --- a/apps/api/src/links/links.service.db.test.ts +++ b/apps/api/src/links/links.service.db.test.ts @@ -277,10 +277,12 @@ describe.skipIf(!hasTestDb)('LinksService.pondGraph (db, issue #111)', () => { { from: a, to: secret }, ].sort((x, y) => x.to.localeCompare(y.to)), ); - expect(graph.phantoms.map((p) => p.targetSlug).sort()).toEqual([ - `ghost-${suffix}`, - `ghost-secret-${suffix}`, - ]); + // Sort BOTH sides: phantom order is not guaranteed, and the two slugs share + // the random suffix so their sort order flips on ~1/5 of suffixes (the + // expected array was previously left unsorted — a latent flake). + expect(graph.phantoms.map((p) => p.targetSlug).sort()).toEqual( + [`ghost-${suffix}`, `ghost-secret-${suffix}`].sort(), + ); }); it('slices every collection to the reader — no hidden page leaks anywhere', async () => {