Summary
The supported-branch test in src/hooks/__tests__/useVocal.test.ts (lines 126-133) asserts instance creation with expect(ref.current).toBeDefined(). In vitest, toBeDefined() only fails for undefined — null counts as defined — so the test passes whether or not the instance was actually created and assigned.
Current state
useVocal initializes ref = useRef<VocalInstance | null>(null) (useVocal.ts:36) and only assigns ref.current = instance inside the effect when supported (useVocal.ts:43-44). The matching no-support test correctly uses .toBeNull() (line 27) — which is exactly the value the supported test would also observe on a creation/assignment regression. No other supported-block test compensates: tests at lines 135, 405-415, and 437-453 only assert that createVocal was called (call counts/args), not that ref.current holds the returned instance. So a broken ref.current = instance assignment would go undetected.
Proposed improvement
Assert expect(ref.current).not.toBeNull() (or capture the mocked return value and assert .toBe(instance)) so the test actually verifies the instance was created and assigned.
Summary
The supported-branch test in
src/hooks/__tests__/useVocal.test.ts(lines 126-133) asserts instance creation withexpect(ref.current).toBeDefined(). In vitest,toBeDefined()only fails forundefined—nullcounts as defined — so the test passes whether or not the instance was actually created and assigned.Current state
useVocalinitializesref = useRef<VocalInstance | null>(null)(useVocal.ts:36) and only assignsref.current = instanceinside the effect when supported (useVocal.ts:43-44). The matching no-support test correctly uses.toBeNull()(line 27) — which is exactly the value the supported test would also observe on a creation/assignment regression. No other supported-block test compensates: tests at lines 135, 405-415, and 437-453 only assert thatcreateVocalwas called (call counts/args), not thatref.currentholds the returned instance. So a brokenref.current = instanceassignment would go undetected.Proposed improvement
Assert
expect(ref.current).not.toBeNull()(or capture the mocked return value and assert.toBe(instance)) so the test actually verifies the instance was created and assigned.