Skip to content

Commit

Permalink
style: ktFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Jan 22, 2025
1 parent ffe50d3 commit 9a62832
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,45 @@ class GoalDaoTest {
}

@Test
fun 목표_저장_테스트() = runTest {
// given
val goals: List<GoalEntity> = fakeGoalEntities("준원", "준혁")
fun 목표_저장_테스트() =
runTest {
// given
val goals: List<GoalEntity> = fakeGoalEntities("준원", "준혁")

// when
goalDao.saveGoals(goals)
// when
goalDao.saveGoals(goals)

// then
val retrievedGoals: List<GoalEntity> = goalDao.getGoals().first()
val retrievedGoalTitles = retrievedGoals.map { it.title }
retrievedGoals.shouldHaveSize(2)
retrievedGoalTitles shouldBe listOf("준원", "준혁")
}
// then
val retrievedGoals: List<GoalEntity> = goalDao.getGoals().first()
val retrievedGoalTitles = retrievedGoals.map { it.title }
retrievedGoals.shouldHaveSize(2)
retrievedGoalTitles shouldBe listOf("준원", "준혁")
}

@Test
fun 목표_저장후_삭제_테스트() = runTest {
// given
val goal: GoalEntity = fakeGoalEntity(id = 1L, title = "준원")
fun 목표_저장후_삭제_테스트() =
runTest {
// given
val goal: GoalEntity = fakeGoalEntity(id = 1L, title = "준원")

// when
goalDao.saveGoal(goal)
goalDao.deleteGoal(goalId = 1L)
// then
val retrievedGoals: List<GoalEntity> = goalDao.getGoals().first()
retrievedGoals.shouldHaveSize(0)
}
// when
goalDao.saveGoal(goal)
goalDao.deleteGoal(goalId = 1L)
// then
val retrievedGoals: List<GoalEntity> = goalDao.getGoals().first()
retrievedGoals.shouldHaveSize(0)
}

@Test
fun 목표_완료하기_테스트() = runTest {
// given
val goal: GoalEntity = fakeGoalEntity(id = 1L, title = "준원", state = Goal.State.Todo)
// when
goalDao.saveGoal(goal)
goalDao.updateGoal(goal.copy(state = Goal.State.Done))
// then
val retrievedGoal: GoalEntity = goalDao.getGoal(1L).first()
retrievedGoal.state shouldBe Goal.State.Done
}
fun 목표_완료하기_테스트() =
runTest {
// given
val goal: GoalEntity = fakeGoalEntity(id = 1L, title = "준원", state = Goal.State.Todo)
// when
goalDao.saveGoal(goal)
goalDao.updateGoal(goal.copy(state = Goal.State.Done))
// then
val retrievedGoal: GoalEntity = goalDao.getGoal(1L).first()
retrievedGoal.state shouldBe Goal.State.Done
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ class DobeDobeMigrationTest {
openHelper.writableDatabase.close()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.chipichipi.dobedobe.core.database.entity.GoalEntity
@Database(
entities = [GoalEntity::class],
version = 1,

)
abstract class DobeDobeDatabase : RoomDatabase() {
abstract fun goalDao(): GoalDao
Expand Down

0 comments on commit 9a62832

Please sign in to comment.