-
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.
- Loading branch information
Showing
4 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
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
34 changes: 34 additions & 0 deletions
34
android/DartsScorecard/data/src/test/java/nl/entreco/data/wtf/FaqApiDataTest.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package nl.entreco.data.wtf | ||
|
||
import nl.entreco.data.api.beta.FeatureApiData | ||
import org.junit.Assert.* | ||
import org.junit.Test | ||
|
||
class FaqApiDataTest{ | ||
private val subject = FaqApiData() | ||
|
||
@Test | ||
fun `video is empty initially`() { | ||
assertEquals("", subject.video) | ||
} | ||
|
||
@Test | ||
fun `image is empty initially`() { | ||
assertEquals("", subject.image) | ||
} | ||
|
||
@Test | ||
fun `title is empty initially`() { | ||
assertEquals("", subject.title) | ||
} | ||
|
||
@Test | ||
fun `desc is empty initially`() { | ||
assertEquals("", subject.desc) | ||
} | ||
|
||
@Test | ||
fun `viewed is zero initially`() { | ||
assertEquals(0, subject.viewed) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ecard/domain/src/test/java/nl/entreco/domain/profile/fetch/FetchProfileStatRequestTest.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package nl.entreco.domain.profile.fetch | ||
|
||
import org.junit.Test | ||
|
||
import org.junit.Assert.* | ||
|
||
class FetchProfileStatRequestTest { | ||
|
||
@Test | ||
fun `should be equal`() { | ||
val one = FetchProfileStatRequest(longArrayOf(1,2,34)) | ||
val two = FetchProfileStatRequest(longArrayOf(1,2,34)) | ||
assertEquals(one, two) | ||
} | ||
|
||
@Test | ||
fun `should not be equal`() { | ||
val one = FetchProfileStatRequest(longArrayOf(1,2,34)) | ||
val two = FetchProfileStatRequest(longArrayOf(1,2,3,4)) | ||
assertNotEquals(one, two) | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
.../DartsScorecard/domain/src/test/java/nl/entreco/domain/wtf/SubmitViewedItemUsecaseTest.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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package nl.entreco.domain.wtf | ||
|
||
import com.nhaarman.mockito_kotlin.any | ||
import com.nhaarman.mockito_kotlin.verify | ||
import nl.entreco.domain.Analytics | ||
import nl.entreco.domain.common.executors.TestBackground | ||
import nl.entreco.domain.common.executors.TestForeground | ||
import nl.entreco.domain.repository.WtfRepository | ||
import org.junit.Test | ||
|
||
import org.junit.Assert.* | ||
import org.junit.Before | ||
import org.junit.runner.RunWith | ||
import org.mockito.Mock | ||
import org.mockito.junit.MockitoJUnitRunner | ||
|
||
@RunWith(MockitoJUnitRunner::class) | ||
class SubmitViewedItemUsecaseTest { | ||
|
||
private val bg = TestBackground() | ||
private val fg = TestForeground() | ||
@Mock private lateinit var mockRepo: WtfRepository | ||
@Mock private lateinit var mockAnalytics: Analytics | ||
private lateinit var subject : SubmitViewedItemUsecase | ||
|
||
|
||
@Before | ||
fun setUp() { | ||
subject = SubmitViewedItemUsecase(mockRepo, mockAnalytics, bg, fg) | ||
} | ||
|
||
@Test | ||
fun `it should use repo`() { | ||
whenExecuting("some id") | ||
verify(mockRepo).viewedItem("some id") | ||
} | ||
|
||
@Test | ||
fun `it should track analytics`() { | ||
whenExecuting("another Id") | ||
verify(mockAnalytics).trackViewFaq(any()) | ||
} | ||
|
||
private fun whenExecuting(docId: String) { | ||
subject.exec(SubmitViewedItemRequest(WtfItem(docId, "tit", "desc", "img", "vid", 2))) | ||
} | ||
} |