Skip to content
This repository was archived by the owner on Feb 17, 2020. It is now read-only.

Commit 99d65ff

Browse files
committed
fix the tests
1 parent 2747dcb commit 99d65ff

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

app/src/main/java/net/squanchy/notification/NotificationCreator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class NotificationCreator(private val context: Context) {
127127

128128
private fun getTrackColor(event: Event): Int {
129129
return event.track
130-
.map { (_, _, _, accentColor) -> Color.parseColor(accentColor.or(ARGB_TRANSPARENT)) }
130+
.map { Color.parseColor(it.accentColor ?: ARGB_TRANSPARENT) }
131131
.or(Color.TRANSPARENT)
132132
}
133133

app/src/test/java/net/squanchy/service/firebase/FirestoreTrackMapperTest.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package net.squanchy.service.firebase
22

33
import com.google.common.truth.Truth.assertThat
44
import net.squanchy.support.checksum.Checksum
5-
import net.squanchy.support.lang.getOrThrow
65
import org.junit.Before
76
import org.junit.Rule
87
import org.junit.Test
@@ -50,41 +49,41 @@ class FirestoreTrackMapperTest {
5049
fun `track url should match when mapped`() {
5150
val firestoreTrack = aFirestoreTrack(iconUrl = A_NAME)
5251
val track = firestoreTrack.toTrack(checksum)
53-
assertThat(track.iconUrl.getOrThrow()).isEqualTo(A_NAME)
52+
assertThat(track.iconUrl).isEqualTo(A_NAME)
5453
}
5554

5655
@Test
5756
fun `track url should be empty when mapping null`() {
5857
val firestoreTrack = aFirestoreTrack(iconUrl = null)
5958
val track = firestoreTrack.toTrack(checksum)
60-
assertThat(track.iconUrl.isEmpty()).isTrue()
59+
assertThat(track.iconUrl).isNull()
6160
}
6261

6362
@Test
6463
fun `accent color should match when mapped`() {
6564
val firestoreTrack = aFirestoreTrack(accentColor = A_COLOR)
6665
val track = firestoreTrack.toTrack(checksum)
67-
assertThat(track.accentColor.getOrThrow()).isEqualTo(A_COLOR)
66+
assertThat(track.accentColor).isEqualTo(A_COLOR)
6867
}
6968

7069
@Test
7170
fun `accent color should be empty when mapping null`() {
7271
val firestoreTrack = aFirestoreTrack(accentColor = null)
7372
val track = firestoreTrack.toTrack(checksum)
74-
assertThat(track.accentColor.isEmpty()).isTrue()
73+
assertThat(track.accentColor).isNull()
7574
}
7675

7776
@Test
7877
fun `text color should match when mapped`() {
7978
val firestoreTrack = aFirestoreTrack(textColor = A_COLOR)
8079
val track = firestoreTrack.toTrack(checksum)
81-
assertThat(track.textColor.getOrThrow()).isEqualTo(A_COLOR)
80+
assertThat(track.textColor).isEqualTo(A_COLOR)
8281
}
8382

8483
@Test
8584
fun `text color should be empty when mapping null`() {
8685
val firestoreTrack = aFirestoreTrack(textColor = null)
8786
val track = firestoreTrack.toTrack(checksum)
88-
assertThat(track.textColor.isEmpty()).isTrue()
87+
assertThat(track.textColor).isNull()
8988
}
9089
}

app/src/test/java/net/squanchy/service/firebase/model/schedule/FirestoreTracksRepositoryTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package net.squanchy.service.firebase.model.schedule
22

3-
import arrow.core.Option
43
import io.reactivex.Observable
54
import net.squanchy.schedule.domain.view.aTrack
65
import net.squanchy.service.firebase.FirestoreDbService
@@ -54,7 +53,7 @@ class FirestoreTracksRepositoryTest {
5453
trackService.tracks()
5554
.test()
5655
.assertValue(
57-
listOf(aTrack(accentColor = Option.empty(), iconUrl = Option.empty(), textColor = Option.empty()))
56+
listOf(aTrack(accentColor = null, iconUrl = null, textColor = null))
5857
)
5958
}
6059

0 commit comments

Comments
 (0)