From fdaf90f6e9a58fa42272f54238ff9b5ef6532052 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sun, 5 Apr 2026 22:46:46 -0700 Subject: [PATCH] test: strengthen clickability test guard assertions The @c ref clickability test previously used if-guards that would silently pass when no Alice line was found in the snapshot output. Both Claude and Codex adversarial review flagged this as a test that could regress without CI noticing. Co-Authored-By: Claude Opus 4.6 --- browse/test/snapshot.test.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/browse/test/snapshot.test.ts b/browse/test/snapshot.test.ts index bcbf8cd7..4b375cda 100644 --- a/browse/test/snapshot.test.ts +++ b/browse/test/snapshot.test.ts @@ -440,13 +440,11 @@ describe('Dropdown/popover detection', () => { const snap = await handleMetaCommand('snapshot', ['-i'], bm, shutdown); // Find a @c ref for Alice const aliceLine = snap.split('\n').find(l => l.includes('@c') && l.includes('Alice')); - if (aliceLine) { - const refMatch = aliceLine.match(/@(c\d+)/); - if (refMatch) { - const result = await handleWriteCommand('click', [`@${refMatch[1]}`], bm); - expect(result).toContain('Clicked'); - } - } + expect(aliceLine).toBeTruthy(); + const refMatch = aliceLine!.match(/@(c\d+)/); + expect(refMatch).toBeTruthy(); + const result = await handleWriteCommand('click', [`@${refMatch![1]}`], bm); + expect(result).toContain('Clicked'); }); test('snapshot -C still works standalone without -i', async () => {