Fix tests
This commit is contained in:
parent
f7972d5ce6
commit
f437aa2986
|
@ -462,6 +462,7 @@ class TimelineDaoTest {
|
|||
contentShowing = true,
|
||||
pinned = false,
|
||||
card = card,
|
||||
quote = null,
|
||||
)
|
||||
return Triple(status, author, reblogAuthor)
|
||||
}
|
||||
|
|
|
@ -20,27 +20,27 @@ class AbsoluteTimeFormatterTest {
|
|||
@Test
|
||||
fun `same day formatting`() {
|
||||
val tenTen = Date.from(Instant.parse("2022-04-11T10:10:00.00Z"))
|
||||
assertEquals("10:10", formatter.format(tenTen, true, now))
|
||||
assertEquals("10:10", formatter.format(tenTen, false, now))
|
||||
assertEquals("10:10:00", formatter.format(tenTen, true, now))
|
||||
assertEquals("10:10:00", formatter.format(tenTen, false, now))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `same year formatting`() {
|
||||
val nextDay = Date.from(Instant.parse("2022-04-12T00:10:00.00Z"))
|
||||
assertEquals("04-12 00:10", formatter.format(nextDay, true, now))
|
||||
assertEquals("04-12 00:10", formatter.format(nextDay, false, now))
|
||||
assertEquals("04/12 00:10", formatter.format(nextDay, true, now))
|
||||
assertEquals("04/12 00:10", formatter.format(nextDay, false, now))
|
||||
val endOfYear = Date.from(Instant.parse("2022-12-31T23:59:00.00Z"))
|
||||
assertEquals("12-31 23:59", formatter.format(endOfYear, true, now))
|
||||
assertEquals("12-31 23:59", formatter.format(endOfYear, false, now))
|
||||
assertEquals("12/31 23:59", formatter.format(endOfYear, true, now))
|
||||
assertEquals("12/31 23:59", formatter.format(endOfYear, false, now))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `other year formatting`() {
|
||||
val firstDayNextYear = Date.from(Instant.parse("2023-01-01T00:00:00.00Z"))
|
||||
assertEquals("2023-01-01", formatter.format(firstDayNextYear, true, now))
|
||||
assertEquals("2023-01-01 00:00", formatter.format(firstDayNextYear, false, now))
|
||||
assertEquals("2023/01/01", formatter.format(firstDayNextYear, true, now))
|
||||
assertEquals("2023/01/01 00:00:00", formatter.format(firstDayNextYear, false, now))
|
||||
val inTenYears = Date.from(Instant.parse("2032-04-11T10:10:00.00Z"))
|
||||
assertEquals("2032-04-11", formatter.format(inTenYears, true, now))
|
||||
assertEquals("2032-04-11 10:10", formatter.format(inTenYears, false, now))
|
||||
assertEquals("2032/04/11", formatter.format(inTenYears, true, now))
|
||||
assertEquals("2032/04/11 10:10:00", formatter.format(inTenYears, false, now))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue