Skip to content

Commit

Permalink
Fix: member fk 수정 사항을 테스트에 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaewon-pro committed Aug 5, 2024
1 parent c4dd451 commit 1ce9707
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
6 changes: 1 addition & 5 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spring:
ddl-auto: none
show-sql: true
open-in-view: false
defer-datasource-initialization: false

datasource:
driver-class-name: org.postgresql.Driver
Expand All @@ -30,10 +31,5 @@ oauth:
---
spring.config.activate.on-profile: local

spring:
jpa:
hibernate:
ddl-auto: update

---
spring.config.activate.on-profile: prod
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.*;

@RepositoryTest
class MemberRepositoryImplTest {
@Autowired
private MemberRepository memberRepository;

@Test
@DisplayName("findById 메서드는 Member를 반환한다.")
@DisplayName("findById 메서드는 해당하는 id의 Member가 없다면 null을 반환한다.")
void findById() {
Member member = memberRepository.findById(1L).orElse(null);
System.out.println(member);
assertNull(member);
}

@Test
Expand All @@ -33,8 +32,6 @@ void save() {
.mainBadge(null)
.createdAt(null)
.updatedAt(null)
.level(null)
.currentExp(0)
.build();
Member savedMember = memberRepository.save(member);
assertNotEquals(0, savedMember.memberId());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.dnd.runus.infrastructure.persistence.jpa.member.entity;

import com.dnd.runus.domain.badge.Badge;
import com.dnd.runus.domain.level.Level;
import com.dnd.runus.domain.member.Member;
import com.dnd.runus.global.constant.BadgeType;
import com.dnd.runus.global.constant.MemberRole;
Expand All @@ -28,8 +27,6 @@ void setUp() {
.mainBadge(badge)
.createdAt(OffsetDateTime.now())
.updatedAt(OffsetDateTime.now())
.level(new Level(1L, 100))
.currentExp(0)
.build();
}

Expand Down
9 changes: 7 additions & 2 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
spring:
jpa:
hibernate:
ddl-auto: create
ddl-auto: none
show-sql: true
open-in-view: false
defer-datasource-initialization: true
defer-datasource-initialization: false

datasource:
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver

flyway:
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver
enabled: true
baseline-on-migrate: true # Baseline 생성이 필요한 상황에서 migration 작업 실행시, Baseline 생성부터 하겠다는 설정

app:
api:
allow-origins: "*"
Expand Down

0 comments on commit 1ce9707

Please sign in to comment.