mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
add test for getWeekdaysInMonth
This commit is contained in:
@@ -118,6 +118,31 @@ class DateUtilsTest : BaseUnitTest() {
|
||||
assertThat(arrayOf("Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri"), equalTo(longWeekdayNames))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWeekdaysInMonth() {
|
||||
val february = GregorianCalendar(2018, Calendar.FEBRUARY, 1)
|
||||
val leapFebruary = GregorianCalendar(2020, Calendar.FEBRUARY, 1)
|
||||
val month = GregorianCalendar(2020, Calendar.APRIL, 1)
|
||||
val longMonth = GregorianCalendar(2020, Calendar.AUGUST, 1)
|
||||
|
||||
assertThat(
|
||||
DateUtils.getWeekdaysInMonth(Timestamp(february)),
|
||||
equalTo(arrayOf(4, 4, 4, 4, 4, 4, 4))
|
||||
)
|
||||
assertThat(
|
||||
DateUtils.getWeekdaysInMonth(Timestamp(leapFebruary)),
|
||||
equalTo(arrayOf(4, 4, 4, 4, 4, 4, 5))
|
||||
)
|
||||
assertThat(
|
||||
DateUtils.getWeekdaysInMonth(Timestamp(month)),
|
||||
equalTo(arrayOf(4, 4, 4, 5, 5, 4, 4))
|
||||
)
|
||||
assertThat(
|
||||
DateUtils.getWeekdaysInMonth(Timestamp(longMonth)),
|
||||
equalTo(arrayOf(5, 5, 4, 4, 4, 4, 5))
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetToday() {
|
||||
setFixedLocalTime(FIXED_LOCAL_TIME)
|
||||
|
||||
Reference in New Issue
Block a user