mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Fix Wiki Love Monuments year (#5049)
* Remove year from messages containing "Wiki Loves Monuments 2021" * Retrieve Wiki Love Monuments year dynamically * Add test and doc
This commit is contained in:
parent
33679eb6b4
commit
789960a966
15 changed files with 60 additions and 16 deletions
28
app/src/test/kotlin/fr/free/nrw/commons/UtilsTest.kt
Normal file
28
app/src/test/kotlin/fr/free/nrw/commons/UtilsTest.kt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package fr.free.nrw.commons
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import java.util.*
|
||||
|
||||
class UtilsTest {
|
||||
@Test
|
||||
fun wikiLovesMonumentsYearBeforeSeptember() {
|
||||
val cal = Calendar.getInstance()
|
||||
cal.set(2022, Calendar.FEBRUARY, 1)
|
||||
Assertions.assertEquals(2021, Utils.getWikiLovesMonumentsYear(cal))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun wikiLovesMonumentsYearInSeptember() {
|
||||
val cal = Calendar.getInstance()
|
||||
cal.set(2022, Calendar.SEPTEMBER, 1)
|
||||
Assertions.assertEquals(2022, Utils.getWikiLovesMonumentsYear(cal))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun wikiLovesMonumentsYearAfterSeptember() {
|
||||
val cal = Calendar.getInstance()
|
||||
cal.set(2022, Calendar.DECEMBER, 1)
|
||||
Assertions.assertEquals(2022, Utils.getWikiLovesMonumentsYear(cal))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue