Skip to content

Commit

Permalink
release: 0.8.3 (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb authored Oct 20, 2024
2 parents 5f5b9d2 + 646fafe commit 192665c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
8 changes: 1 addition & 7 deletions src/main/kotlin/org/gitanimals/render/domain/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,7 @@ class User(
personas.add(newPersona)
}

fun giveBonusPersona(persona: String) {
val personaType = PersonaType.valueOf(persona.uppercase())

require(bonusPersonas.contains(personaType)) {
"Cannot select as a bonus persona."
}

fun giveNewPersonaByType(personaType: PersonaType) {
personas.add(getPersona(personaType))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class UserService(

val user = getUserByName(name)

user.giveBonusPersona(persona)
user.giveNewPersonaByType(PersonaType.valueOf(persona.uppercase()))
}

@Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100)
Expand Down
8 changes: 4 additions & 4 deletions src/test/kotlin/org/gitanimals/render/domain/UserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,22 @@ internal class UserTest : DescribeSpec({
describe("giveBonusPersona ๋ฉ”์†Œ๋“œ๋Š”") {
context("Bonus pet ๋ชฉ๋ก์— ๋“ฑ๋ก๋œ pet์˜ ์ด๋ฆ„์ด ์ฃผ์–ด์งˆ ๊ฒฝ์šฐ,") {
val user = User.newUser("new-user", mutableMapOf())
val persona = "PENGUIN"
val persona = PersonaType.PENGUIN

it("์ƒˆ๋กœ์šด ํŽซ์„ ์ง€๊ธ‰ํ•œ๋‹ค.") {
user.giveBonusPersona(persona)
user.giveNewPersonaByType(persona)

user.personas.find { it.type == PersonaType.PENGUIN }.shouldNotBeNull()
}
}

context("Bonus pet ๋ชฉ๋ก์— ๋“ฑ๋ก๋˜์ง€ ์•Š์€ pet์˜ ์ด๋ฆ„์ด ์ฃผ์–ด์งˆ ๊ฒฝ์šฐ,") {
val user = User.newUser("new-user", mutableMapOf())
val persona = "GOBLIN_BAG"
val persona = PersonaType.GOBLIN_BAG

it("์˜ˆ์™ธ๋ฅผ ๋˜์ง„๋‹ค.") {
shouldThrowWithMessage<IllegalArgumentException>("Cannot select as a bonus persona.") {
user.giveBonusPersona(persona)
user.giveNewPersonaByType(persona)
}
}
}
Expand Down

0 comments on commit 192665c

Please sign in to comment.