fix(01-14): satisfy vue-tsc strict-null checks in usePaidItemViewer.test.ts
All checks were successful
Demo images / Build & push demo images (push) Successful in 3m41s

npm run build's vue-tsc -b pass caught TS2532 (possibly-undefined array
access) on two array-index reads the vitest run alone doesn't type-check —
optional-chain them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-07-31 22:29:28 -04:00
parent 0c63a8518c
commit 4a8925f09e

View File

@ -95,7 +95,7 @@ describe('usePaidItemViewer — UIFIX-04 (lightbox routing) + UIFIX-06 (loading/
expect(windowOpenSpy).not.toHaveBeenCalled()
expect(viewer.lightboxIndex.value).toBe(0)
expect(viewer.lightboxItems.value[0].name).toBe('holiday.mp4')
expect(viewer.lightboxItems.value[0]?.name).toBe('holiday.mp4')
})
it('routes an audio mime to the audio player, never the lightbox', async () => {
@ -128,7 +128,7 @@ describe('usePaidItemViewer — UIFIX-04 (lightbox routing) + UIFIX-06 (loading/
await viewer.open(IMAGE_ITEM)
expect(viewer.lightboxItems.value[0].name.endsWith('.jpg')).toBe(true)
expect(viewer.lightboxItems.value[0]?.name.endsWith('.jpg')).toBe(true)
})
it('sets opening for the whole duration of the fetch and clears it on success', async () => {