Skip to content

Commit

Permalink
[TEST] 출석 체크 테스트 재개
Browse files Browse the repository at this point in the history
  • Loading branch information
thguss committed May 29, 2024
1 parent f03d550 commit a664b7f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ void setUp() {
diaryRepository.deleteAllInBatch();
member = memberRepository.save(MemberFixture.member().build());
}

@AfterEach
void tearDown() {
diaryRepository.deleteAllInBatch();
memberRepository.deleteAllInBatch();
}

@Test
@Transactional
@DisplayName("[성공] 오늘 일기를 작성하지 않은 회원은 일기를 작성할 수 있고, 연속 일기 작성 수가 업데이트된다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import com.smeem.support.fixture.MemberFixture;
import jakarta.transaction.Transactional;
import lombok.val;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.*;
import org.springframework.beans.factory.annotation.Autowired;

import static org.assertj.core.api.Assertions.*;
Expand Down Expand Up @@ -44,23 +41,23 @@ public void setUp() {
member = memberRepository.save(MemberFixture.member().build());
}

// @Test
// @Transactional
// @DisplayName("[성공] 회원이 방문하면 하루에 한 번 이력이 남는다.")
// void createMemberVisitedHistoryTodayAtOnce() {
// // given
// val request = new MemberVisitUpdateRequest(member.getId());
//
// int initCount = visitCounter.countByMember(member);
// assertThat(initCount).isEqualTo(0);
//
// // when
// memberService.updateMemberVisit(request);
// memberService.updateMemberVisit(request);
//
// // then
// int visitCount = visitCounter.countByMember(member);
// assertThat(visitCount).isEqualTo(1);
// }
@Test
@Transactional
@DisplayName("[성공] 회원이 방문하면 하루에 한 번 이력이 남는다.")
void createMemberVisitedHistoryTodayAtOnce() {
// given
val request = new MemberVisitUpdateRequest(member.getId());

int initCount = visitCounter.countByMember(member);
assertThat(initCount).isEqualTo(0);

// when
memberService.updateMemberVisit(request);
memberService.updateMemberVisit(request);

// then
int visitCount = visitCounter.countByMember(member);
assertThat(visitCount).isEqualTo(1);
}
}
}

0 comments on commit a664b7f

Please sign in to comment.