-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/site/katchup/springboot/entity/MemberWorkSpace.kt
This file contains 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,15 @@ | ||
package site.katchup.springboot.entity | ||
|
||
import jakarta.persistence.Entity | ||
import jakarta.persistence.GeneratedValue | ||
import jakarta.persistence.GenerationType | ||
import jakarta.persistence.Id | ||
|
||
@Entity | ||
class MemberWorkSpace( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val id: Long? = null, | ||
val memberId: Long, | ||
val workSpaceId: Long, | ||
) |
This file contains 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,5 @@ | ||
package site.katchup.springboot.entity | ||
|
||
enum class SocialType { | ||
GOOGLE, | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/site/katchup/springboot/entity/WorkSpace.kt
This file contains 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,16 @@ | ||
package site.katchup.springboot.entity | ||
|
||
import jakarta.persistence.Entity | ||
import jakarta.persistence.GeneratedValue | ||
import jakarta.persistence.GenerationType.IDENTITY | ||
import jakarta.persistence.Id | ||
|
||
@Entity | ||
class WorkSpace( | ||
@Id | ||
@GeneratedValue(strategy = IDENTITY) | ||
val id: Long? = null, | ||
val name: String, | ||
val description: String, | ||
val domain: String, | ||
) |
33 changes: 33 additions & 0 deletions
33
src/test/kotlin/site/katchup/springboot/repository/MemberRepositoryTest.kt
This file contains 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,33 @@ | ||
package site.katchup.springboot.repository | ||
|
||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.shouldBe | ||
import site.katchup.springboot.entity.Member | ||
import site.katchup.springboot.entity.SocialType | ||
|
||
@RepositoryTest | ||
class MemberRepositoryTest( | ||
private val memberRepository: MemberRepository, | ||
) : FunSpec({ | ||
|
||
test("신규 회원을 등록할 수 있다.") { | ||
// given | ||
val member = Member( | ||
name = "name", | ||
nickname = "nickname", | ||
socialId = "socialId", | ||
socialType = SocialType.GOOGLE, | ||
lineMemo = "lineMemo", | ||
workSpaceId = 1, | ||
) | ||
val savedMember = memberRepository.save(member) | ||
val findMember = memberRepository.findById(savedMember.id!!).get() | ||
findMember.id shouldBe savedMember.id | ||
findMember.name shouldBe "name" | ||
findMember.nickname shouldBe "nickname" | ||
findMember.socialId shouldBe "socialId" | ||
findMember.socialType shouldBe SocialType.GOOGLE | ||
findMember.lineMemo shouldBe "lineMemo" | ||
findMember.workSpaceId shouldBe 1 | ||
} | ||
},) |
10 changes: 10 additions & 0 deletions
10
src/test/kotlin/site/katchup/springboot/repository/RepositoryTest.kt
This file contains 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,10 @@ | ||
package site.katchup.springboot.repository | ||
|
||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest | ||
import org.springframework.context.annotation.ComponentScan | ||
import org.springframework.test.context.ActiveProfiles | ||
|
||
@DataJpaTest | ||
@ActiveProfiles("test") | ||
@ComponentScan("site.katchup.springboot.repository") | ||
annotation class RepositoryTest() |