diff --git a/gitnexus/test/unit/repo-projection.test.ts b/gitnexus/test/unit/repo-projection.test.ts index 86eda3e00..cc8191e97 100644 --- a/gitnexus/test/unit/repo-projection.test.ts +++ b/gitnexus/test/unit/repo-projection.test.ts @@ -119,7 +119,12 @@ describe('projectRepoListEntry — GET /api/repos', () => { const b = projectRepoListEntry(entry({ name: 'api', path: '/ws/b/api' }), FRESH, FULL_SOURCE); expect(a.id).not.toBe(b.id); expect(a.id).toBe(publicRepoId('/ws/a/api')); - expect(a.id).not.toContain('ws'); + // The id is an HMAC under a per-process random key, so a short substring + // such as 'ws' appears in it by chance (~0.5% of runs). Assert the opaque + // base64url shape instead; '/' is outside that alphabet, so the path can + // never appear in the id by chance. + expect(a.id).toMatch(/^[A-Za-z0-9_-]{22}$/); + expect(a.id).not.toContain('/ws/a/api'); }); it('keeps every field the route returned before, unchanged', () => {