-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test:TOP-96 사용되지 않는 테스트코드 주석 처리(data 모듈 termDao)
- Loading branch information
Showing
2 changed files
with
67 additions
and
67 deletions.
There are no files selected for viewing
98 changes: 49 additions & 49 deletions
98
data/src/test/java/com/tht/tht/data/datasource/TermsDataSourceImplTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() } | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters