Skip to content

Commit

Permalink
πŸ§ͺ Update: TestCode
Browse files Browse the repository at this point in the history
  • Loading branch information
jun108059 committed Nov 18, 2024
1 parent 96b4af3 commit 4dc9292
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class SkiResortControllerTest @Autowired constructor(
)
// Given
val skiResorts = listOf(
SkiResortResponseDto(1, "μŠ€ν‚€μž₯ A", ResortStatus.μš΄μ˜μ€‘.name, 3, currentWeather, weeklyWeather),
SkiResortResponseDto(2, "μŠ€ν‚€μž₯ B", ResortStatus.μš΄μ˜μ€‘.name, 4, currentWeather, weeklyWeather),
SkiResortResponseDto(1, "μŠ€ν‚€μž₯ A", ResortStatus.μš΄μ˜μ€‘.name, "λ―Έμ •", "λ―Έμ •", 3, currentWeather, weeklyWeather),
SkiResortResponseDto(2, "μŠ€ν‚€μž₯ B", ResortStatus.μš΄μ˜μ€‘.name, "λ―Έμ •", "λ―Έμ •", 4, currentWeather, weeklyWeather),
)
every { skiResortService.getAllSkiResortsAndWeather() } returns skiResorts

Expand Down
30 changes: 27 additions & 3 deletions src/test/kotlin/nexters/weski/ski_resort/SkiResortServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,34 @@ class SkiResortServiceTest {
fun `getAllSkiResorts should return list of SkiResortDto`() {
// Given
val skiResorts = listOf(
SkiResort(1, "μŠ€ν‚€μž₯ A", ResortStatus.μš΄μ˜μ€‘, null, null, 5, 10),
SkiResort(2, "μŠ€ν‚€μž₯ B", ResortStatus.μ˜ˆμ •, null, null, 0, 8)
SkiResort(
resortId = 1,
name = "μŠ€ν‚€μž₯ A",
status = ResortStatus.μš΄μ˜μ€‘,
openingDate = null,
closingDate = null,
openSlopes = 3,
totalSlopes = 8,
xCoordinate = "12.0",
yCoordinate = "34.0",
detailedAreaCode = "11D20201",
broadAreaCode = "11D20000"
),
SkiResort(
resortId = 2,
name = "μŠ€ν‚€μž₯ B",
status = ResortStatus.μš΄μ˜μ€‘,
openingDate = null,
closingDate = null,
openSlopes = 3,
totalSlopes = 8,
xCoordinate = "12.0",
yCoordinate = "34.0",
detailedAreaCode = "11D20201",
broadAreaCode = "11D20000"
)
)
every { skiResortRepository.findAll() } returns skiResorts
every { skiResortRepository.findAllByOrderByOpeningDateAsc() } returns skiResorts
every { currentWeatherRepository.findBySkiResortResortId(any()) } returns null
every { dailyWeatherRepository.findAllBySkiResortResortId(any()) } returns emptyList()

Expand Down
14 changes: 13 additions & 1 deletion src/test/kotlin/nexters/weski/snow_maker/SnowMakerServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,19 @@ class SnowMakerServiceTest {
// Given
val resortId = 1L
val isPositive = true
val skiResort = SkiResort(resortId, "μŠ€ν‚€μž₯ A", ResortStatus.μš΄μ˜μ€‘, null, null, 5, 10)
val skiResort = SkiResort(
resortId = 1,
name = "μŠ€ν‚€μž₯ A",
status = ResortStatus.μš΄μ˜μ€‘,
openingDate = null,
closingDate = null,
openSlopes = 3,
totalSlopes = 8,
xCoordinate = "12.0",
yCoordinate = "34.0",
detailedAreaCode = "11D20201",
broadAreaCode = "11D20000"
)
val snowMakerVote = SnowMakerVote(
isPositive = isPositive,
skiResort = skiResort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class WeatherServiceTest {
resortId, -5, -2, -8, -10, "눈이 내리고 μžˆμŠ΅λ‹ˆλ‹€.", "눈", skiResort
)
every { currentWeatherRepository.findBySkiResortResortId(resortId) } returns currentWeather
every { hourlyWeatherRepository.findAll() } returns listOf()
every { hourlyWeatherRepository.findBySkiResortResortId(resortId) } returns listOf()
every { dailyWeatherRepository.findAllBySkiResortResortId(resortId) } returns listOf()

// When
Expand Down

0 comments on commit 4dc9292

Please sign in to comment.