Skip to content

Commit

Permalink
style: ktlint format 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
songpink committed Dec 16, 2024
1 parent b288858 commit caa01c2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,28 @@ class UpdateCommentRoomsUseCaseTest {
}

@Test
fun `댓글방 목록을 불러오는 데 성공한다`() = runTest {
// given
(commentRoomsRepository as FakeCommentRoomsRepository).isAccessTokenValid = true
fun `댓글방 목록을 불러오는 데 성공한다`() =
runTest {
// given
(commentRoomsRepository as FakeCommentRoomsRepository).isAccessTokenValid = true

// when
val result = updateCommentRoomsUseCase()
// when
val result = updateCommentRoomsUseCase()

// then
assertThat(result).isInstanceOf(Result.Success::class.java)
}
// then
assertThat(result).isInstanceOf(Result.Success::class.java)
}

@Test
fun `AccessToken이 만료되면 토큰을 갱신하고 재시도해 댓글방 목록을 불러온다`() = runTest {
// given
(commentRoomsRepository as FakeCommentRoomsRepository).isAccessTokenValid = false

// when
val result = updateCommentRoomsUseCase()

// then
assertThat(result).isInstanceOf(Result.Success::class.java)
}
}
fun `AccessToken이 만료되면 토큰을 갱신하고 재시도해 댓글방 목록을 불러온다`() =
runTest {
// given
(commentRoomsRepository as FakeCommentRoomsRepository).isAccessTokenValid = false

// when
val result = updateCommentRoomsUseCase()

// then
assertThat(result).isInstanceOf(Result.Success::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ import com.zzang.chongdae.common.datastore.UserPreferencesDataStore
import com.zzang.chongdae.common.handler.Result
import com.zzang.chongdae.repository.FakeAuthRepository
import com.zzang.chongdae.repository.FakeDataStore
import com.zzang.chongdae.util.CoroutinesTestExtension
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

class PostLoginUseCaseTest {
private lateinit var authRepository: AuthRepository
Expand All @@ -26,13 +23,14 @@ class PostLoginUseCaseTest {
}

@Test
fun `로그인에 성공한다`() = runTest {
// given
fun `로그인에 성공한다`() =
runTest {
// given

// when
val result = postLoginUseCase("FakeAccessToken", "FakeRefreshToken")
// when
val result = postLoginUseCase("FakeAccessToken", "FakeRefreshToken")

// then
assertThat(result).isInstanceOf(Result.Success::class.java)
}
}
// then
assertThat(result).isInstanceOf(Result.Success::class.java)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.zzang.chongdae.presentation.view.comment

import com.zzang.chongdae.auth.repository.AuthRepository
import com.zzang.chongdae.domain.repository.CommentRoomsRepository
import com.zzang.chongdae.domain.usecase.comment.UpdateCommentRoomsUseCaseImpl
import com.zzang.chongdae.repository.FakeAuthRepository
import com.zzang.chongdae.repository.FakeCommentRoomsRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package com.zzang.chongdae.presentation.view.write

import com.zzang.chongdae.auth.repository.AuthRepository
import com.zzang.chongdae.domain.repository.OfferingRepository
import com.zzang.chongdae.domain.usecase.offeringmodify.PostOfferingModifyUseCase
import com.zzang.chongdae.domain.usecase.write.PostOfferingUseCase
import com.zzang.chongdae.domain.usecase.write.PostOfferingUseCaseImpl
import com.zzang.chongdae.domain.usecase.write.PostProductImageOgUseCase
import com.zzang.chongdae.domain.usecase.write.PostProductImageOgUseCaseImpl
import com.zzang.chongdae.domain.usecase.write.UploadImageFileUseCase
import com.zzang.chongdae.domain.usecase.write.UploadImageFileUseCaseImpl
import com.zzang.chongdae.presentation.view.write.OfferingWriteViewModel.Companion.HTTPS
import com.zzang.chongdae.repository.FakeAuthRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.zzang.chongdae.util.TestFixture

class FakeCommentRoomsRepository : CommentRoomsRepository {
var isAccessTokenValid = true

override suspend fun fetchCommentRooms(): Result<List<CommentRoom>, DataError.Network> {
return when (isAccessTokenValid) {
true -> Result.Success(TestFixture.COMMENT_ROOMS_STUB)
Expand Down

0 comments on commit caa01c2

Please sign in to comment.