Skip to content

Commit

Permalink
test: 회원 createdAt 저장 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
nuyh99 committed Nov 27, 2023
1 parent ecd3f46 commit 30b2f65
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.example.busan.member.domain;

import com.example.busan.DatabaseCleaner;
import com.example.busan.auth.domain.PasswordEncoder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import static org.assertj.core.api.Assertions.assertThat;

@SpringBootTest
class MemberRepositoryTest {

@Autowired
private MemberRepository memberRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private DatabaseCleaner databaseCleaner;

@BeforeEach
void setUp() {
databaseCleaner.truncate();
}

@Test
@DisplayName("멤버 저장 시 시간도 저장된다")
void save() {
//given
final Member member = new Member("[email protected]", "salmon", "@@pasSword1", Region.BUSAN, "01012341234", "company", passwordEncoder);

//when
final Member saved = memberRepository.save(member);

//then
assertThat(saved.getCreatedAt()).isNotNull();
}

}

0 comments on commit 30b2f65

Please sign in to comment.