Skip to content

Feature/integration tests - #5

Merged
YukiJanse merged 2 commits into
mainfrom
feature/integration-tests
Feb 6, 2026
Merged

YukiJanse merged 2 commits into
mainfrom
feature/integration-tests

Conversation

@YukiJanse

Copy link
Copy Markdown
Owner

Added LikeService and MuteService integration tests

Copilot AI review requested due to automatic review settings February 6, 2026 20:59
@YukiJanse
YukiJanse merged commit 8e9a704 into main Feb 6, 2026
6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Spring Boot integration tests around the “like” and “mute” service flows, plus a small repository tweak to support mute creation.

Changes:

  • Added LikeServiceIntegrationTest covering like/unlike for posts and comments, plus list endpoints.
  • Added MuteServiceIntegrationTest covering mute/unmute and listing mutings.
  • Updated MuteRepository#createMuteRelationship native insert to also set updated_at.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/test/java/se/jensen/yuki/springboot/service/MuteServiceIntegrationTest.java New integration tests for muting/unmuting and listing mutings.
src/test/java/se/jensen/yuki/springboot/service/LikeServiceIntegrationTest.java New integration tests for post/comment like flows and like list retrieval.
src/main/java/se/jensen/yuki/springboot/repository/MuteRepository.java Adjusts native insert to include updated_at timestamp.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import se.jensen.yuki.springboot.model.Comment;
import se.jensen.yuki.springboot.model.Post;
import se.jensen.yuki.springboot.model.User;
import se.jensen.yuki.springboot.repository.*;

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using a wildcard repository import in tests; it makes it harder to see which repositories are actually used and is inconsistent with the other integration tests in this package (which import repositories explicitly). Replace se.jensen.yuki.springboot.repository.* with the specific repository imports used by this test.

Suggested change
import se.jensen.yuki.springboot.repository.*;
import se.jensen.yuki.springboot.repository.UserRepository;
import se.jensen.yuki.springboot.repository.PostRepository;
import se.jensen.yuki.springboot.repository.CommentRepository;
import se.jensen.yuki.springboot.repository.PostLikeRepository;
import se.jensen.yuki.springboot.repository.CommentLikeRepository;

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +85

muteService.muteUser(user1.getId(), user2.getId());

MuteResponse res =
muteService.muteUser(user1.getId(), user2.getId());

assertThat(res).isNotNull();

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is named muteUser_shouldNotDuplicate but it only asserts the second call returns non-null; it doesn’t verify that only one mute relationship exists. Consider asserting the mutings list size remains 1 (e.g., via muteService.getMutings(...)) after calling muteUser twice, or otherwise checking the persisted relationship count, so the test actually covers the behavior implied by its name.

Suggested change
muteService.muteUser(user1.getId(), user2.getId());
MuteResponse res =
muteService.muteUser(user1.getId(), user2.getId());
assertThat(res).isNotNull();
// First mute call creates the relationship
muteService.muteUser(user1.getId(), user2.getId());
// Second mute call should not create a duplicate
MuteResponse res =
muteService.muteUser(user1.getId(), user2.getId());
assertThat(res).isNotNull();
// Verify only one mute relationship exists
Slice<MuteMutingResponse> slice =
muteService.getMutings(
user1.getId(),
PageRequest.of(0, 10)
);
assertThat(slice).isNotNull();
assertThat(slice.getContent()).hasSize(1);
assertThat(slice.getContent().get(0).mutedUserId()).isEqualTo(user2.getId());

Copilot uses AI. Check for mistakes.
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.

2 participants