Skip to content

Commit

Permalink
test:TOP-96 사용되지 않는 테스트코드 주석 처리(data 모듈 termDao)
Browse files Browse the repository at this point in the history
  • Loading branch information
taewooyo committed Jul 11, 2024
1 parent 5efab17 commit 991a242
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 67 deletions.
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
package com.tht.tht.data.datasource

import com.tht.tht.data.local.datasource.TermsDataSourceImpl
import com.tht.tht.data.local.entity.TermsEntity
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.mockk
//package com.tht.tht.data.datasource
//
//import com.tht.tht.data.local.datasource.TermsDataSourceImpl
//import com.tht.tht.data.local.entity.TermsEntity
//import io.mockk.coEvery
//import io.mockk.coVerify
//import io.mockk.mockk
//import kotlinx.coroutines.test.StandardTestDispatcher
//import kotlinx.coroutines.test.TestCoroutineScheduler
//import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestCoroutineScheduler
import kotlinx.coroutines.test.runTest
import org.assertj.core.api.Assertions.assertThat
import org.junit.Before
import org.junit.Test

@Suppress("NonAsciiCharacters")
@ExperimentalCoroutinesApi
internal class TermsDataSourceImplTest {

private lateinit var dataSource: TermsDataSourceImpl
private lateinit var dao: TermsService
private val testDispatcher = StandardTestDispatcher(TestCoroutineScheduler())

@Before
fun setUpTest() {
dao = mockk(relaxed = true)
dataSource = TermsDataSourceImpl(
dao,
testDispatcher
)
}

@Test
fun `fetchSignupTerms는 TermsDao의 fetchSignupTerms의 결과를 리턴한다`() = runTest(testDispatcher) {
val expect = TermsEntity(
listOf(
TermsEntity.Body(
listOf(TermsEntity.Body.Content("content", "title")),
true,
"title",
"key",
"description1"
)
)
)
coEvery { dao.fetchTerms() } returns expect
val actual = dataSource.fetchSignupTerms()

assertThat(actual)
.isEqualTo(expect)
}

@Test
fun `fetchSignupTerms는 TermsDao의 fetchSignupTerms를 호출한다`() = runTest(testDispatcher) {
dataSource.fetchSignupTerms()
coVerify { dao.fetchTerms() }
}
//
// private lateinit var dataSource: TermsDataSourceImpl
// private lateinit var dao: TermsService
// private val testDispatcher = StandardTestDispatcher(TestCoroutineScheduler())
//
// @Before
// fun setUpTest() {
// dao = mockk(relaxed = true)
// dataSource = TermsDataSourceImpl(
// dao,
// testDispatcher
// )
// }
//
// @Test
// fun `fetchSignupTerms는 TermsDao의 fetchSignupTerms의 결과를 리턴한다`() = runTest(testDispatcher) {
// val expect = TermsEntity(
// listOf(
// TermsEntity.Body(
// listOf(TermsEntity.Body.Content("content", "title")),
// true,
// "title",
// "key",
// "description1"
// )
// )
// )
// coEvery { dao.fetchTerms() } returns expect
// val actual = dataSource.fetchSignupTerms()
//
// assertThat(actual)
// .isEqualTo(expect)
// }
//
// @Test
// fun `fetchSignupTerms는 TermsDao의 fetchSignupTerms를 호출한다`() = runTest(testDispatcher) {
// dataSource.fetchSignupTerms()
// coVerify { dao.fetchTerms() }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,24 @@ internal class SignupRepositoryImplTest {
.isEqualTo(expect)
}

@Test
fun `fetchTerms는 TermsDataSource의 fetchTerms의 결과를 Model로 가공해 리턴한다`() = runTest(testDispatcher) {
val expect = TermsEntity(
listOf(
TermsEntity.Body(
listOf(TermsEntity.Body.Content("content", "title")),
true,
"title",
"key",
"description1"
)
)
)
coEvery { termsDataSource.fetchSignupTerms() } returns expect
val actual = repository.fetchTerms()
assertThat(actual)
.isEqualTo(expect.body.map { it.toModel() })
}
// @Test
// fun `fetchTerms는 TermsDataSource의 fetchTerms의 결과를 Model로 가공해 리턴한다`() = runTest(testDispatcher) {
// val expect = TermsEntity(
// listOf(
// TermsEntity.Body(
// listOf(TermsEntity.Body.Content("content", "title")),
// true,
// "title",
// "key",
// "description1"
// )
// )
// )
// coEvery { termsDataSource.fetchSignupTerms() } returns expect
// val actual = repository.fetchTerms()
// assertThat(actual)
// .isEqualTo(expect.body.map { it.toModel() })
// }

@Test
fun `checkNicknameDuplicate는 SignupApiDataSource의 checkNicknameDuplicate의 결과를 리턴한다`() =
Expand Down

0 comments on commit 991a242

Please sign in to comment.