From caa01c24c7b0b04f671695ca565484f7dfb66104 Mon Sep 17 00:00:00 2001 From: songpink Date: Mon, 16 Dec 2024 16:46:56 +0900 Subject: [PATCH] =?UTF-8?q?style:=20ktlint=20format=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../comment/UpdateCommentRoomsUseCaseTest.kt | 40 ++++++++++--------- .../usecase/login/PostLoginUseCaseTest.kt | 20 +++++----- .../view/comment/CommentRoomsViewModelTest.kt | 2 - .../view/write/OfferingWriteViewModelTest.kt | 6 --- .../repository/FakeCommentRoomsRepository.kt | 1 + 5 files changed, 31 insertions(+), 38 deletions(-) diff --git a/android/app/src/test/java/com/zzang/chongdae/domain/usecase/comment/UpdateCommentRoomsUseCaseTest.kt b/android/app/src/test/java/com/zzang/chongdae/domain/usecase/comment/UpdateCommentRoomsUseCaseTest.kt index d6759fd3..4e40ef6c 100644 --- a/android/app/src/test/java/com/zzang/chongdae/domain/usecase/comment/UpdateCommentRoomsUseCaseTest.kt +++ b/android/app/src/test/java/com/zzang/chongdae/domain/usecase/comment/UpdateCommentRoomsUseCaseTest.kt @@ -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) - } -} \ No newline at end of file + fun `AccessToken이 만료되면 토큰을 갱신하고 재시도해 댓글방 목록을 불러온다`() = + runTest { + // given + (commentRoomsRepository as FakeCommentRoomsRepository).isAccessTokenValid = false + + // when + val result = updateCommentRoomsUseCase() + + // then + assertThat(result).isInstanceOf(Result.Success::class.java) + } +} diff --git a/android/app/src/test/java/com/zzang/chongdae/domain/usecase/login/PostLoginUseCaseTest.kt b/android/app/src/test/java/com/zzang/chongdae/domain/usecase/login/PostLoginUseCaseTest.kt index 2f8eebe2..d90f182a 100644 --- a/android/app/src/test/java/com/zzang/chongdae/domain/usecase/login/PostLoginUseCaseTest.kt +++ b/android/app/src/test/java/com/zzang/chongdae/domain/usecase/login/PostLoginUseCaseTest.kt @@ -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 @@ -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) - } -} \ No newline at end of file + // then + assertThat(result).isInstanceOf(Result.Success::class.java) + } +} diff --git a/android/app/src/test/java/com/zzang/chongdae/presentation/view/comment/CommentRoomsViewModelTest.kt b/android/app/src/test/java/com/zzang/chongdae/presentation/view/comment/CommentRoomsViewModelTest.kt index 976fe2d5..a9c64e32 100644 --- a/android/app/src/test/java/com/zzang/chongdae/presentation/view/comment/CommentRoomsViewModelTest.kt +++ b/android/app/src/test/java/com/zzang/chongdae/presentation/view/comment/CommentRoomsViewModelTest.kt @@ -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 diff --git a/android/app/src/test/java/com/zzang/chongdae/presentation/view/write/OfferingWriteViewModelTest.kt b/android/app/src/test/java/com/zzang/chongdae/presentation/view/write/OfferingWriteViewModelTest.kt index 6516a45b..21a3a3eb 100644 --- a/android/app/src/test/java/com/zzang/chongdae/presentation/view/write/OfferingWriteViewModelTest.kt +++ b/android/app/src/test/java/com/zzang/chongdae/presentation/view/write/OfferingWriteViewModelTest.kt @@ -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 diff --git a/android/app/src/test/java/com/zzang/chongdae/repository/FakeCommentRoomsRepository.kt b/android/app/src/test/java/com/zzang/chongdae/repository/FakeCommentRoomsRepository.kt index 17c974aa..147da867 100644 --- a/android/app/src/test/java/com/zzang/chongdae/repository/FakeCommentRoomsRepository.kt +++ b/android/app/src/test/java/com/zzang/chongdae/repository/FakeCommentRoomsRepository.kt @@ -8,6 +8,7 @@ import com.zzang.chongdae.util.TestFixture class FakeCommentRoomsRepository : CommentRoomsRepository { var isAccessTokenValid = true + override suspend fun fetchCommentRooms(): Result, DataError.Network> { return when (isAccessTokenValid) { true -> Result.Success(TestFixture.COMMENT_ROOMS_STUB)