test: update tests for security fixes (origin validation, streaming state)

- archyIntegration: expect window.location.origin instead of '*' for
  postMessage calls (matches FIX-009 origin restriction)
- useAI: fix flaky isStreaming assertion to account for background
  fetch calls (refreshWavlakeCatalog) captured before streaming starts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-06 01:42:50 +00:00
co-authored by Claude Opus 4.6
parent 9adeab9420
commit e97c8f36ac
2 changed files with 7 additions and 6 deletions
+3 -2
View File
@@ -223,8 +223,9 @@ describe('useAI', () => {
expect(chatStore.isStreaming).toBe(false)
await sendMessage('hi')
expect(chatStore.isStreaming).toBe(false)
// During the fetch call, isStreaming should have been true
expect(streamingStates[0]).toBe(true)
// During the streaming fetch call, isStreaming should have been true
// (earlier non-streaming fetches like refreshWavlakeCatalog may also be captured)
expect(streamingStates.some(s => s === true)).toBe(true)
})
it('handles stream errors gracefully', async () => {