Skip to content

test(social): add unit tests for useOptimisticLike and useOptimisticRepost#345

Open
DSanich wants to merge 1 commit into
divinevideo:mainfrom
DSanich:test/340-optimistic-like-repost
Open

test(social): add unit tests for useOptimisticLike and useOptimisticRepost#345
DSanich wants to merge 1 commit into
divinevideo:mainfrom
DSanich:test/340-optimistic-like-repost

Conversation

@DSanich
Copy link
Copy Markdown
Contributor

@DSanich DSanich commented May 7, 2026

Summary

  • Add src/hooks/useOptimisticLike.test.ts covering optimistic video-social-metrics / video-user-interactions updates, kind 5 delete when unliking with a stored like event id, kind 7 like publish with e / a / p tags (including vineId: null address form), skip publish when unliking without an event id, likeCount floored at 0 on unlike, and rollback + destructive toast when publishEvent fails (like and unlike paths).
  • Add src/hooks/useOptimisticRepost.test.ts covering kind 5 un-repost, repostVideo arguments and returned repostEventId, skip publish when removing repost without an event id, repostCount floored at 0, and rollback when repostVideo or kind 5 delete fails.

Avoid naming corporate partners, customers, or other sensitive external brands in this PR title or body. Use generic descriptors unless a maintainer explicitly approves the public reference.

Motivation

  • useOptimisticLike and useOptimisticRepost power high-traffic social UI but had no colocated tests; components only mocked these hooks, so cache keys, optimistic deltas, Nostr publish calls, and error rollback were easy to regress silently.

Related Issue

Testing

  • npm run test
  • Manual verification completed

Visuals

  • UI change with screenshots/video attached
  • No visual change
  • Visuals and text avoid sensitive external brand or partner names unless explicitly approved

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🚀 Preview Deployment

Property Value
Preview URL https://054c6c4c.divine-web-fm8.pages.dev
Commit 2ad2387
Branch test/340-optimistic-like-repost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(social): unit tests for useOptimisticLike and useOptimisticRepost

1 participant