Skip to content

[Testing] Add unit tests for useIncomingStreams / useWithdrawIncomingStream (query key, enabled gating, invalidation, null-session error) #855

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

frontend/src/hooks/useIncomingStreams.ts is untested. Critical react-query behavior is unverified: incomingStreamsQueryKey, enabled-gating on publicKey, onSuccess invalidating the exact key, and the mutation throwing connect your wallet first when session is null.

Acceptance criteria

  • Test useIncomingStreams stays disabled (no fetch) when publicKey is null/undefined
  • Test the query key shape returned by incomingStreamsQueryKey
  • Test useWithdrawIncomingStream rejects when session is null and invalidates incomingStreamsQueryKey(publicKey) on success
  • Mock fetchIncomingStreams/withdrawFromStream with a QueryClientProvider wrapper

Files to touch

  • frontend/src/hooks/useIncomingStreams.ts

Out of scope

  • Tests for lib/api/_shared.ts

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programfrontendFrontend related taskstestingTesting related tasks

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions