Skip to content

Commit

Permalink
test: 테스트용 db 사용하게끔 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
peeerr committed Nov 6, 2024
1 parent 4a9b1be commit 4fd36e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spring:
jdbc:
time_zone: Asia/Seoul
hibernate:
ddl-auto: update
ddl-auto: none

h2:
console:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;

@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class DiaryRepositoryTest {

@Autowired
Expand All @@ -29,9 +26,6 @@ class DiaryRepositoryTest {
@Autowired
private MemberRepository memberRepository;

@Autowired
private TestEntityManager entityManager;

@Test
@DisplayName("일기가 성공적으로 저장된다.")
void should_SaveDiary_When_ValidEntity() {
Expand Down Expand Up @@ -59,8 +53,6 @@ void should_FindDiaries_When_FilteringByMember() {
Diary diary2 = createDiary(member, "Content 2", "Busan", "Address 2");

diaryRepository.saveAll(List.of(diary1, diary2));
entityManager.flush();
entityManager.clear();

// when
Specification<Diary> spec = (root, query, builder) ->
Expand Down Expand Up @@ -104,8 +96,6 @@ void should_FindDiaries_When_FilteringWithSearchCriteria() {
.build();

diaryRepository.saveAll(List.of(diary1, diary2));
entityManager.flush();
entityManager.clear();

// when
Specification<Diary> spec = DiarySpecification.filterDiaries(
Expand Down Expand Up @@ -155,8 +145,6 @@ void should_FindDiaries_When_FilteringBookmarked() {
.build();

diaryRepository.saveAll(List.of(diary1, diary2));
entityManager.flush();
entityManager.clear();

// when
Specification<Diary> spec = DiarySpecification.filterDiaries(
Expand Down Expand Up @@ -197,5 +185,5 @@ private Diary createDiary(Member member, String content, String locationName, St
.isPublic(false)
.build();
}

}

0 comments on commit 4fd36e9

Please sign in to comment.