Skip to content

test: add and fix chat and messaging component tests (#48)#308

Merged
flyblackbox merged 2 commits intoQuoteVote:mainfrom
Om7035:feature/issue-48-chat-messaging-tests
Mar 25, 2026
Merged

test: add and fix chat and messaging component tests (#48)#308
flyblackbox merged 2 commits intoQuoteVote:mainfrom
Om7035:feature/issue-48-chat-messaging-tests

Conversation

@Om7035
Copy link
Copy Markdown
Collaborator

@Om7035 Om7035 commented Mar 17, 2026

Description

Closes #48

This Pull Request introduces 100% test coverage for the Chat and Messaging components within quotevote-frontend, ensuring real-time behavior, message rendering, input handling, and presence indicators are robust and regression-free.

Changes Made

  • PostChatReactions.test.tsx: Added comprehensive tests validating emoji picker behavior, reaction grouping with accurate counts, and mutations for adding/updating PostChat message reactions.
  • PresenceIcon.test.tsx: Added test coverage validating correct SVG mapping/colour coding across all user presence states (online, away, dnd, offline, invisible).
  • ChatList.test.tsx: Added full coverage testing component rendering conditionally on group/direct message filtering, search terms, selected room highlighting, and properly rendering group fallback avatars vs targeted avatars.
  • ChatList.tsx Bugfix: Resolved a React rendering bug where a zero value for total unreadMessages strictly rendered text 0 on the UI badge instead of rendering nothing.

Acceptance Criteria Satisfied

  • Test files explicitly exist for Chat, PostChat, and nested properties (including PresenceIcon & ChatList).
  • All 14 test suites and 144 independent test units across Chat/Messaging pass locally.
  • Recompiled production application without any build breakages (npm run build).

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Test (enhancing testing structure/unit testing framework)

Test Instructions

Reviewers can pull this branch, navigate to quotevote-frontend/, and execute:

npm run test -- --testPathPattern="__tests__/components/(Chat|PostChat|BuddyList)"




@vercel
Copy link
Copy Markdown

vercel bot commented Mar 17, 2026

@Om7035 is attempting to deploy a commit to the Louis Girifalco's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Om7035
Copy link
Copy Markdown
Collaborator Author

Om7035 commented Mar 17, 2026

@flyblackbox check this one is complete and All tests will exit successfully with 0 failures.

@flyblackbox
Copy link
Copy Markdown
Contributor

Nice work @Om7035!
Can we get review and approval from one more? @motirebuma @OtavioXimarelli @shubham-01-star

@shubham-01-star
Copy link
Copy Markdown
Collaborator

Hey @Om7035,

Nice work! The tests look good and cover important cases. I just have a couple of small suggestions:

1.PostChatReactions.test.tsx - Using JSON.stringify(m).includes('AddReaction') might break easily. It may be better to use:
expect(mockMutate).toHaveBeenCalledWith(expect.objectContaining({ mutation: AddReactionMutation }));

  1. ChatList.test.tsx - Using <img> can make the page load slower and use more bandwidth. You could use <Image /> from next/image for better optimization.

Overall: Approved these are small suggestions only. Great work!

@flyblackbox flyblackbox merged commit 3af118e into QuoteVote:main Mar 25, 2026
2 of 3 checks passed
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.

3 participants