Skip to content
Snippets Groups Projects
Unverified Commit b5741152 authored by Ralf Gehrer's avatar Ralf Gehrer Committed by GitHub
Browse files

Update release info text for 1.14.x (EXPOSUREAPP-5158) #2375


* Update release info strings (EXPOSUREAPP-5158)

* Update heading

* Extend release notes to allow for linkified labels on an per-entry basis

* Fix ktlint issues

* Fix and add tests

* Update default strings

* Add tests to ensure string arrays are correct in all locales

Co-authored-by: default avatarI502720 <axel.herbstreith@sap.com>
parent 52812491
No related branches found
No related tags found
No related merge requests found
Showing
with 316 additions and 97 deletions
...@@ -13,6 +13,7 @@ import de.rki.coronawarnapp.databinding.NewReleaseInfoScreenFragmentBinding ...@@ -13,6 +13,7 @@ import de.rki.coronawarnapp.databinding.NewReleaseInfoScreenFragmentBinding
import de.rki.coronawarnapp.ui.lists.BaseAdapter import de.rki.coronawarnapp.ui.lists.BaseAdapter
import de.rki.coronawarnapp.util.di.AutoInject import de.rki.coronawarnapp.util.di.AutoInject
import de.rki.coronawarnapp.util.lists.BindableVH import de.rki.coronawarnapp.util.lists.BindableVH
import de.rki.coronawarnapp.util.setUrl
import de.rki.coronawarnapp.util.ui.doNavigate import de.rki.coronawarnapp.util.ui.doNavigate
import de.rki.coronawarnapp.util.ui.observe2 import de.rki.coronawarnapp.util.ui.observe2
import de.rki.coronawarnapp.util.ui.popBackStack import de.rki.coronawarnapp.util.ui.popBackStack
...@@ -68,7 +69,9 @@ class NewReleaseInfoFragment : Fragment(R.layout.new_release_info_screen_fragmen ...@@ -68,7 +69,9 @@ class NewReleaseInfoFragment : Fragment(R.layout.new_release_info_screen_fragmen
private fun getItems(): List<NewReleaseInfoItem> { private fun getItems(): List<NewReleaseInfoItem> {
val titles = resources.getStringArray(R.array.new_release_title) val titles = resources.getStringArray(R.array.new_release_title)
val textBodies = resources.getStringArray(R.array.new_release_body) val textBodies = resources.getStringArray(R.array.new_release_body)
return vm.getItems(titles, textBodies) val linkifiedLabels = resources.getStringArray(R.array.new_release_linkified_labels)
val linkTargets = resources.getStringArray(R.array.new_release_target_urls)
return vm.getItems(titles, textBodies, linkifiedLabels, linkTargets)
} }
override fun onResume() { override fun onResume() {
...@@ -92,7 +95,11 @@ private class ItemAdapter( ...@@ -92,7 +95,11 @@ private class ItemAdapter(
NewReleaseInfoItemBinding.(item: NewReleaseInfoItem, payloads: List<Any>) -> Unit = NewReleaseInfoItemBinding.(item: NewReleaseInfoItem, payloads: List<Any>) -> Unit =
{ item, _ -> { item, _ ->
title.text = item.title title.text = item.title
body.text = item.body if (item is NewReleaseInfoItemLinked) {
body.setUrl(item.body, item.linkifiedLabel, item.linkTarget)
} else {
body.text = item.body
}
} }
} }
......
package de.rki.coronawarnapp.release package de.rki.coronawarnapp.release
data class NewReleaseInfoItem( interface NewReleaseInfoItem {
val title: String, val title: String
val body: String val body: String
) }
data class NewReleaseInfoItemText(
override val title: String,
override val body: String
) : NewReleaseInfoItem
data class NewReleaseInfoItemLinked(
override val title: String,
override val body: String,
val linkifiedLabel: String,
val linkTarget: String
) : NewReleaseInfoItem
...@@ -27,14 +27,25 @@ class NewReleaseInfoViewModel @AssistedInject constructor( ...@@ -27,14 +27,25 @@ class NewReleaseInfoViewModel @AssistedInject constructor(
routeToScreen.postValue(NewReleaseInfoNavigationEvents.CloseScreen) routeToScreen.postValue(NewReleaseInfoNavigationEvents.CloseScreen)
} }
fun getItems(titles: Array<String>, bodies: Array<String>): List<NewReleaseInfoItem> { fun getItems(
if (titles.size != bodies.size) { titles: Array<String>,
Timber.e("R.array.new_release_title and R.array.new_release_body must have the same size!") bodies: Array<String>,
linkifiedLabels: Array<String>,
linkTargets: Array<String>
): List<NewReleaseInfoItem> {
if (titles.size != bodies.size || titles.size != linkifiedLabels.size || titles.size != linkTargets.size) {
Timber.e(
"R.array.new_release_title AND R.array.new_release_body AND " +
"R.array.new_release_linkified_AND R.array.new_release_target_urls arrays must have the same size!"
)
return emptyList()
} }
val items = mutableListOf<NewReleaseInfoItem>() val items = mutableListOf<NewReleaseInfoItem>()
titles.indices.forEach { titles.indices.forEach { i ->
if (it <= bodies.lastIndex) { if (linkifiedLabels[i].isNullOrBlank() || linkTargets[i].isNullOrBlank()) {
items.add(NewReleaseInfoItem(titles[it], bodies[it])) items.add(NewReleaseInfoItemText(titles[i], bodies[i]))
} else {
items.add(NewReleaseInfoItemLinked(titles[i], bodies[i], linkifiedLabels[i], linkTargets[i]))
} }
} }
return items return items
......
...@@ -21,60 +21,24 @@ fun TextView.convertToHyperlink(url: String) { ...@@ -21,60 +21,24 @@ fun TextView.convertToHyperlink(url: String) {
movementMethod = LinkMovementMethod.getInstance() movementMethod = LinkMovementMethod.getInstance()
} }
fun TextView.setUrlText(@StringRes textRes: Int, url: String) { fun TextView.setUrl(@StringRes textRes: Int, @StringRes labelRes: Int, @StringRes urlRes: Int) {
context.getString(textRes, url).also { setUrl(context.getString(textRes), context.getString(labelRes), context.getString(urlRes))
val indexOf = it.indexOf(url)
setText(
SpannableString(it).apply {
setSpan(
URLSpan(url),
indexOf,
indexOf + url.length,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
},
TextView.BufferType.SPANNABLE
)
movementMethod = LinkMovementMethod.getInstance()
}
} }
fun TextView.setUrl(@StringRes textRes: Int, label: String, url: String) { fun TextView.setUrl(@StringRes textRes: Int, label: String, url: String) {
context.getString(textRes).also { setUrl(context.getString(textRes), label, url)
val indexOf = it.indexOf(label)
if (indexOf > 0) {
setText(
SpannableString(it).apply {
setSpan(
URLSpan(url),
indexOf,
indexOf + label.length,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
},
TextView.BufferType.SPANNABLE
)
movementMethod = LinkMovementMethod.getInstance()
} else {
text = it
}
}
} }
fun TextView.setUrl(@StringRes textRes: Int, @StringRes labelRes: Int, @StringRes urlRes: Int) { fun TextView.setUrl(content: String, label: String, url: String) {
val url = context.getString(urlRes) val indexOf = content.indexOf(label)
val label = context.getString(labelRes) if (indexOf > 0) {
context.getString(textRes).also { setText(
val indexOf = it.indexOf(label) SpannableStringBuilder(content).urlSpan(indexOf, indexOf + label.length, url),
if (indexOf > 0) { TextView.BufferType.SPANNABLE
setText( )
SpannableStringBuilder(it).urlSpan(indexOf, indexOf + label.length, url), movementMethod = LinkMovementMethod.getInstance()
TextView.BufferType.SPANNABLE } else {
) text = content
movementMethod = LinkMovementMethod.getInstance()
} else {
text = it
}
} }
} }
......
...@@ -34,4 +34,24 @@ ...@@ -34,4 +34,24 @@
<item>"В приложението вече има по-подробна информация относно процедурата за тестване."</item> <item>"В приложението вече има по-подробна информация относно процедурата за тестване."</item>
</string-array> </string-array>
<!-- XTXT: Text labels that will be converted to Links -->
<string-array name="new_release_linkified_labels">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
<!-- XTXT: URL destinations for the lables in new_release_linkified_labels -->
<string-array name="new_release_target_urls">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" tools:ignore="MissingTranslation"> <resources xmlns:tools="http://schemas.android.com/tools" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" tools:ignore="MissingTranslation">
<!-- #################################### <!-- ####################################
Release Info Screen 1.12 Release Info Screen 1.14
###################################### --> ###################################### -->
<!-- XHED: Title for the release info screen --> <!-- XHED: Title for the release info screen -->
...@@ -17,22 +17,34 @@ ...@@ -17,22 +17,34 @@
<!-- XHED: Titles for the release info screen bullet points --> <!-- XHED: Titles for the release info screen bullet points -->
<string-array name="new_release_title"> <string-array name="new_release_title">
<item>Link auf RKI-Umfrage</item> <item>Zusatzfunktionen im Kontakt-Tagebuch</item>
<item>Einwilligung zur Datenspende (optional)</item> <item>Direkter Zugriff auf Kontakt-Tagebuch</item>
<item>Anpassungen der Risiko-Karten</item> <item>Mehr Details zum Risikostatus</item>
<item>Fortführung der Risiko-Ermittlung nach Teilung der Zufalls-IDs</item> <item>Screenshots zur Corona-Warn-App</item>
<item>Einführung von Registerkarten</item>
<item>Mehr Informationen zum Testablauf</item>
</string-array> </string-array>
<!-- XTXT: Text bodies for the release info screen bullet points --> <!-- XTXT: Text bodies for the release info screen bullet points -->
<string-array name="new_release_body"> <string-array name="new_release_body">
<item>Wenn Sie ein erhöhtes Risiko haben, können Sie aus der App heraus eine Umfrage des Robert-Koch-Instituts aufrufen und daran teilnehmen.</item> <item>Sie können zu jedem Eintrag angeben, unter welchen Umständen die Begegnung stattfand. Sie können aus vorgegebenen Optionen auswählen (z.B. Dauer der Begegnung, mit oder ohne Maske) sowie zusätzlich in einer kurzen Notiz weitere Umstände erfassen, die zu einem erhöhten Risiko führen könnten. Sollten Sie sich tatsächlich anstecken, können diese Angaben dem Gesundheitsamt bei der Nachverfolgung möglicher Infektionsketten helfen.</item>
<item>Sie haben nun die Möglichkeit, Ihre Nutzungsdaten zur Verfügung zu stellen und uns somit bei der Verbesserung der App zu unterstützen.</item> <item>Sie können nun direkt einen Eintrag im Kontakt-Tagebuch hinzufügen, ohne erst die App öffnen zu müssen. Tippen Sie dazu etwa 2 Sekunden lang auf das Icon der Corona-Warn-App bis ein Menü erscheint und tippen Sie dann auf "Tagebuch-Eintrag für heute hinzufügen“.</item>
<item>Die Texte auf den Risiko-Karten wurden leicht angepasst.</item> <item>Wenn Ihnen in der App ein erhöhtes Risiko angezeigt wird, können Sie nun sehen, ob der Risikostatus aufgrund einer bzw. mehrerer Begegnungen mit erhöhtem Risiko angezeigt wird, oder aufgrund von mehreren Begegnungen mit niedrigem Risiko.</item>
<item>Nachdem Sie Ihre verschlüsselten Zufalls-IDs geteilt haben, können Sie entscheiden, ob und wann Sie die Risiko-Ermittlung wieder einschalten.</item> <item>Auf https://www.coronawarn.app stehen nun alle Screenshots der App zu Verfügung. So können Sie sich nun auch über geplante Funktionen der App informieren.</item>
<item>Es gibt nun eine eigene Registerkarte für das Kontakt-Tagebuch. Somit können Sie schneller auf Ihr Tagebuch zugreifen und vom Kontakt-Tagebuch wieder zurück auf die Startseite der App wechseln.</item> </string-array>
<item>Die App enthält nun detaillierte Informationen zum Testablauf.</item>
<!-- XTXT: Text labels that will be converted to Links -->
<string-array name="new_release_linkified_labels">
<item></item>
<item></item>
<item></item>
<item>https://www.coronawarn.app</item>
</string-array>
<!-- XTXT: URL destinations for the lables in new_release_linkified_labels -->
<string-array name="new_release_target_urls">
<item></item>
<item></item>
<item></item>
<item>https://www.coronawarn.app/de/screenshots</item>
</string-array> </string-array>
</resources> </resources>
...@@ -34,4 +34,24 @@ ...@@ -34,4 +34,24 @@
<item>"The app now contains more detailed information about the testing procedure."</item> <item>"The app now contains more detailed information about the testing procedure."</item>
</string-array> </string-array>
<!-- XTXT: Text labels that will be converted to Links -->
<string-array name="new_release_linkified_labels">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
<!-- XTXT: URL destinations for the lables in new_release_linkified_labels -->
<string-array name="new_release_target_urls">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
</resources> </resources>
\ No newline at end of file
...@@ -34,4 +34,24 @@ ...@@ -34,4 +34,24 @@
<item>"Aplikacja zawiera teraz bardziej szczegółowe informacje na temat procedury testowania."</item> <item>"Aplikacja zawiera teraz bardziej szczegółowe informacje na temat procedury testowania."</item>
</string-array> </string-array>
<!-- XTXT: Text labels that will be converted to Links -->
<string-array name="new_release_linkified_labels">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
<!-- XTXT: URL destinations for the lables in new_release_linkified_labels -->
<string-array name="new_release_target_urls">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
</resources> </resources>
\ No newline at end of file
...@@ -34,4 +34,24 @@ ...@@ -34,4 +34,24 @@
<item>"Aplicația conține acum informații mai detaliate despre procedura de testare."</item> <item>"Aplicația conține acum informații mai detaliate despre procedura de testare."</item>
</string-array> </string-array>
<!-- XTXT: Text labels that will be converted to Links -->
<string-array name="new_release_linkified_labels">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
<!-- XTXT: URL destinations for the lables in new_release_linkified_labels -->
<string-array name="new_release_target_urls">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
</resources> </resources>
\ No newline at end of file
...@@ -34,4 +34,24 @@ ...@@ -34,4 +34,24 @@
<item>"Uygulama artık test prosedürü hakkında daha ayrıntılı bilgiler içermektedir."</item> <item>"Uygulama artık test prosedürü hakkında daha ayrıntılı bilgiler içermektedir."</item>
</string-array> </string-array>
<!-- XTXT: Text labels that will be converted to Links -->
<string-array name="new_release_linkified_labels">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
<!-- XTXT: URL destinations for the lables in new_release_linkified_labels -->
<string-array name="new_release_target_urls">
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
<item></item>
</string-array>
</resources> </resources>
\ No newline at end of file
...@@ -17,22 +17,34 @@ ...@@ -17,22 +17,34 @@
<!-- XHED: Titles for the release info screen bullet points --> <!-- XHED: Titles for the release info screen bullet points -->
<string-array name="new_release_title"> <string-array name="new_release_title">
<item>"Link to RKI survey"</item> <item>EN: Zusatzfunktionen im Kontakt-Tagebuch</item>
<item>"Consent to Share Data (optional)"</item> <item>Direkter Zugriff auf Kontakt-Tagebuch</item>
<item>"Changes to the Risk Tiles"</item> <item>Mehr Details zum Risikostatus</item>
<item>"Continuation of Exposure Logging after Sharing Your Random IDs"</item> <item>Screenshots zur Corona-Warn-App</item>
<item>"Implementation of Tabs"</item>
<item>"More Information about the Testing Procedure"</item>
</string-array> </string-array>
<!-- XTXT: Text bodies for the release info screen bullet points --> <!-- XTXT: Text bodies for the release info screen bullet points -->
<string-array name="new_release_body"> <string-array name="new_release_body">
<item>"If you have an increased risk, you can start and take a survey conducted by the Robert Koch Institute from within the app."</item> <item>EN: Sie können zu jedem Eintrag angeben, unter welchen Umständen die Begegnung stattfand. Sie können aus vorgegebenen Optionen auswählen (z.B. Dauer der Begegnung, mit oder ohne Maske) sowie zusätzlich in einer kurzen Notiz weitere Umstände erfassen, die zu einem erhöhten Risiko führen könnten. Sollten Sie sich tatsächlich anstecken, können diese Angaben dem Gesundheitsamt bei der Nachverfolgung möglicher Infektionsketten helfen.</item>
<item>"You now have the option of sharing your usage data, which will help us to improve the app."</item> <item>Sie können nun direkt einen Eintrag im Kontakt-Tagebuch hinzufügen, ohne erst die App öffnen zu müssen. Tippen Sie dazu etwa 2 Sekunden lang auf das Icon der Corona-Warn-App bis ein Menü erscheint und tippen Sie dann auf "Tagebuch-Eintrag für heute hinzufügen“.</item>
<item>"Minor changes to the texts on the risk tiles."</item> <item>Wenn Ihnen in der App ein erhöhtes Risiko angezeigt wird, können Sie nun sehen, ob der Risikostatus aufgrund einer bzw. mehrerer Begegnungen mit erhöhtem Risiko angezeigt wird, oder aufgrund von mehreren Begegnungen mit niedrigem Risiko.</item>
<item>"After you have shared your encrypted random IDs, you can decide whether and when you want to switch exposure logging back on."</item> <item>Auf https://www.coronawarn.app stehen nun alle Screenshots der App zu Verfügung. So können Sie sich nun auch über geplante Funktionen der App informieren.</item>
<item>"There is now a separate tab page for your contact journal. This lets you access your journal and switch from the contact journal back to the home screen of the app more quickly."</item> </string-array>
<item>"The app now contains more detailed information about the testing procedure."</item>
<!-- XTXT: Text labels that will be converted to Links -->
<string-array name="new_release_linkified_labels">
<item></item>
<item></item>
<item></item>
<item>https://www.coronawarn.app</item>
</string-array>
<!-- XTXT: URL destinations for the lables in new_release_linkified_labels -->
<string-array name="new_release_target_urls">
<item></item>
<item></item>
<item></item>
<item>https://www.coronawarn.app/en/screenshots</item>
</string-array> </string-array>
</resources> </resources>
package de.rki.coronawarnapp.release
import android.content.Context
import android.os.Build
import androidx.test.core.app.ApplicationProvider
import de.rki.coronawarnapp.R
import io.kotest.matchers.shouldBe
import io.mockk.MockKAnnotations
import io.mockk.clearAllMocks
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import testhelpers.BaseTest
import testhelpers.EmptyApplication
@Config(sdk = [Build.VERSION_CODES.P], application = EmptyApplication::class)
@RunWith(RobolectricTestRunner::class)
class NewReleaseInfoFragmentTest : BaseTest() {
@Before
fun setup() {
MockKAnnotations.init(this)
}
@After
fun tearDown() {
clearAllMocks()
}
val context: Context
get() = ApplicationProvider.getApplicationContext()
@Config(qualifiers = "de")
@Test
fun `ensure GERMAN new release info arrays are of equal length`() = loadAndCompareStringArrayResources()
@Config(qualifiers = "en")
@Test
fun `ensure ENGLISH new release info arrays are of equal length`() = loadAndCompareStringArrayResources()
@Config(qualifiers = "pl")
@Test
fun `ensure POLISH new release info arrays are of equal length`() = loadAndCompareStringArrayResources()
@Config(qualifiers = "ro")
@Test
fun `ensure ROMANIAN new release info arrays are of equal length`() = loadAndCompareStringArrayResources()
@Config(qualifiers = "tr")
@Test
fun `ensure TURKISH new release info arrays are of equal length`() = loadAndCompareStringArrayResources()
@Config(qualifiers = "fr")
@Test
fun `ensure DEFAULT aka FRENCH new release info arrays are of equal length`() = loadAndCompareStringArrayResources()
private fun loadAndCompareStringArrayResources() {
val titles = context.resources.getStringArray(R.array.new_release_title)
val bodies = context.resources.getStringArray(R.array.new_release_body)
val labels = context.resources.getStringArray(R.array.new_release_linkified_labels)
val urls = context.resources.getStringArray(R.array.new_release_target_urls)
titles.size shouldBe bodies.size
bodies.size shouldBe labels.size
labels.size shouldBe urls.size
}
}
\ No newline at end of file
...@@ -36,29 +36,58 @@ class NewReleaseInfoViewModelTest { ...@@ -36,29 +36,58 @@ class NewReleaseInfoViewModelTest {
} }
@Test @Test
fun testGetInfoItem() { fun `title and body shall be mapped to list of items`() {
val item1 = NewReleaseInfoItem("title", "body") val item1 = NewReleaseInfoItemText("title", "body")
val item2 = NewReleaseInfoItem("title2", "body2") val item2 = NewReleaseInfoItemText("title2", "body2")
val titles = arrayOf(item1.title, item2.title) val titles = arrayOf(item1.title, item2.title)
val bodies = arrayOf(item1.body, item2.body) val bodies = arrayOf(item1.body, item2.body)
viewModel.getItems(titles, bodies) shouldBe listOf(item1, item2) viewModel.getItems(titles, bodies, arrayOf("",""), arrayOf("","")) shouldBe listOf(item1, item2)
} }
@Test @Test
fun testGetInfoItemTitleMissing() { fun `missing title results in an empty list`() {
val item1 = NewReleaseInfoItem("title", "body") val item1 = NewReleaseInfoItemText("title", "body")
val item2 = NewReleaseInfoItem("title2", "body2") val item2 = NewReleaseInfoItemText("title2", "body2")
val titles = arrayOf(item1.title) val titles = arrayOf(item1.title)
val bodies = arrayOf(item1.body, item2.body) val bodies = arrayOf(item1.body, item2.body)
viewModel.getItems(titles, bodies) shouldBe listOf(item1) viewModel.getItems(titles, bodies, arrayOf("",""), arrayOf("","")) shouldBe emptyList()
} }
@Test @Test
fun testGetInfoItemBodyMissing() { fun `missing body results in an empty list`() {
val item1 = NewReleaseInfoItem("title", "body") val item1 = NewReleaseInfoItemText("title", "body")
val item2 = NewReleaseInfoItem("title2", "body2") val item2 = NewReleaseInfoItemText("title2", "body2")
val titles = arrayOf(item1.title, item2.title) val titles = arrayOf(item1.title, item2.title)
val bodies = arrayOf(item1.body) val bodies = arrayOf(item1.body)
viewModel.getItems(titles, bodies) shouldBe listOf(item1) viewModel.getItems(titles, bodies, arrayOf("",""), arrayOf("","")) shouldBe emptyList()
}
@Test
fun `missing linkified label results in an empty list`() {
val item1 = NewReleaseInfoItemText("title", "body")
val item2 = NewReleaseInfoItemText("title2", "body2")
val titles = arrayOf(item1.title, item2.title)
val bodies = arrayOf(item1.body, item2.body)
viewModel.getItems(titles, bodies, arrayOf(""), arrayOf("","")) shouldBe emptyList()
}
@Test
fun `missing target url results in an empty list`() {
val item1 = NewReleaseInfoItemText("title", "body")
val item2 = NewReleaseInfoItemText("title2", "body2")
val titles = arrayOf(item1.title, item2.title)
val bodies = arrayOf(item1.body, item2.body)
viewModel.getItems(titles, bodies, arrayOf("",""), arrayOf("")) shouldBe emptyList()
}
@Test
fun `items with and without links are mapped successfully`() {
val item1 = NewReleaseInfoItemText("title", "body")
val item2 = NewReleaseInfoItemLinked("title2", "body2", "label2", "url2")
val titles = arrayOf(item1.title, item2.title)
val bodies = arrayOf(item1.body, item2.body)
val linkifiedLabels = arrayOf("", item2.linkifiedLabel)
val linkTargets = arrayOf("", item2.linkTarget)
viewModel.getItems(titles, bodies, linkifiedLabels, linkTargets) shouldBe listOf(item1, item2)
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment