-
Notifications
You must be signed in to change notification settings - Fork 2
[feature] 모집글 수정 시 최근 업데이트 일자를 보여준다 #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lepitaaar
merged 6 commits into
develop/be
from
feature/#893-show-last-updated-on-post-edit-MOA-393
Dec 7, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
backend/src/test/java/moadong/club/service/ClubProfileServiceDateTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| package moadong.club.service; | ||
|
|
||
| import moadong.club.entity.Club; | ||
| import moadong.club.payload.request.ClubRecruitmentInfoUpdateRequest; | ||
| import moadong.club.repository.ClubRepository; | ||
| import moadong.club.repository.ClubSearchRepository; | ||
| import moadong.club.util.RecruitmentStateCalculator; | ||
| import moadong.fixture.ClubRequestFixture; | ||
| import moadong.fixture.UserFixture; | ||
| import moadong.user.payload.CustomUserDetails; | ||
| import moadong.util.annotations.UnitTest; | ||
| import org.junit.jupiter.api.DisplayName; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.extension.ExtendWith; | ||
| import org.mockito.InjectMocks; | ||
| import org.mockito.Mock; | ||
| import org.mockito.Mockito; | ||
| import org.mockito.Spy; | ||
| import org.mockito.junit.jupiter.MockitoExtension; | ||
|
|
||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.Optional; | ||
|
|
||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
| import static org.mockito.ArgumentMatchers.any; | ||
| import static org.mockito.Mockito.when; | ||
|
|
||
| @ExtendWith(MockitoExtension.class) | ||
| @UnitTest | ||
| public class ClubProfileServiceDateTest { | ||
|
|
||
| @InjectMocks | ||
| ClubProfileService clubProfileService; | ||
|
|
||
| @Mock | ||
| ClubRepository clubRepository; | ||
|
|
||
| @Mock | ||
| ClubSearchRepository clubSearchRepository; | ||
|
|
||
| @DisplayName("모집글 수정 시 최근 업데이트 일자를 보여준다") | ||
| @Test | ||
| void 모집글_수정_시_최근_업데이트_일자를_보여줘야한다(){ | ||
| //GIVEN | ||
| ClubRecruitmentInfoUpdateRequest request = ClubRequestFixture.defaultRequest(); | ||
| CustomUserDetails customUserDetails = UserFixture.createUserDetails("test"); | ||
| Club club = new Club(); | ||
| when(clubRepository.findClubByUserId(any())).thenReturn(Optional.of(club)); | ||
| //updateClubRecruitmentInfo의 RecruitmentStateCalculator 무시 | ||
| try (var mocked = Mockito.mockStatic(RecruitmentStateCalculator.class)) { | ||
| mocked.when(() -> | ||
| RecruitmentStateCalculator.calculate( | ||
| Mockito.any(moadong.club.entity.Club.class), | ||
| Mockito.any(java.time.ZonedDateTime.class), | ||
| Mockito.any(java.time.ZonedDateTime.class) | ||
| ) | ||
| ).thenAnswer(inv -> null); | ||
|
|
||
| //WHEN | ||
| clubProfileService.updateClubRecruitmentInfo(request, customUserDetails); | ||
|
|
||
| //THEN | ||
| assertNotNull(club.getClubRecruitmentInformation().getLastModifiedDate()); | ||
| //1초 전후 차이로 살펴보기 | ||
| LocalDateTime now = LocalDateTime.now(); | ||
| assertTrue(club.getClubRecruitmentInformation(). | ||
| getLastModifiedDate().isAfter(now.minusSeconds(1))); | ||
| assertTrue(club.getClubRecruitmentInformation(). | ||
| getLastModifiedDate().isBefore(now.plusSeconds(1))); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.