Date utils test (#380)
* Add test for date parsing * Add test for the older api * Correct milliseconds format
This commit is contained in:
parent
721a15ec21
commit
6b887ff74b
@ -0,0 +1,31 @@
|
||||
package apps.amine.bou.readerforselfoss
|
||||
|
||||
import apps.amine.bou.readerforselfoss.utils.Config
|
||||
import apps.amine.bou.readerforselfoss.utils.parseDate
|
||||
import org.junit.Test
|
||||
|
||||
class DateUtilsTest {
|
||||
|
||||
@Test
|
||||
fun parseDateV4() {
|
||||
|
||||
Config.apiVersion = 4
|
||||
val dateString = "2013-04-07T13:43:00+01:00"
|
||||
|
||||
val milliseconds = parseDate(dateString).toEpochMilli()
|
||||
val correctMilliseconds : Long = 1365338580000
|
||||
|
||||
assert(milliseconds == correctMilliseconds)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseDateV1() {
|
||||
Config.apiVersion = 0
|
||||
val dateString = "2013-04-07 13:43:00"
|
||||
|
||||
val milliseconds = parseDate(dateString).toEpochMilli()
|
||||
val correctMilliseconds = 1365342180000
|
||||
|
||||
assert(milliseconds == correctMilliseconds)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user