Add new route push notifications
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package pl.firmatpp.kierowca.sync
|
||||
|
||||
import java.time.LocalDate
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import pl.firmatpp.kierowca.data.model.DriverRouteDto
|
||||
|
||||
class NewRouteNotificationFormatterTest {
|
||||
@Test
|
||||
fun formatsHumanRouteDates() {
|
||||
val today = LocalDate.of(2026, 7, 2)
|
||||
|
||||
assertEquals("Nowy kurs: dzisiaj", NewRouteNotificationFormatter.title("2026-07-02", today))
|
||||
assertEquals("Nowy kurs: jutro", NewRouteNotificationFormatter.title("2026-07-03", today))
|
||||
assertEquals("Nowy kurs: w sobotę", NewRouteNotificationFormatter.title("2026-07-04", today))
|
||||
assertEquals("Nowy kurs: 12 lipca", NewRouteNotificationFormatter.title("2026-07-12", today))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun formatsCollapsedAndExpandedRouteText() {
|
||||
val route = DriverRouteDto(
|
||||
id = "42",
|
||||
routeDate = "2026-07-03",
|
||||
startsAt = "09:15",
|
||||
originName = "TPP Baza Krakow",
|
||||
destinationName = "Instalacja Odpadowa Slask",
|
||||
contractorName = "TPP Baza Krakow",
|
||||
contractName = "Odpady przemyslowe",
|
||||
contractCode = "TPP-ODP-24",
|
||||
relationLabel = "TPP Baza Krakow -> Instalacja Odpadowa Slask",
|
||||
status = "ZAPLANOWANA",
|
||||
distanceKm = 91.4,
|
||||
notes = null,
|
||||
truck = null,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
"TPP Baza Krakow → Instalacja Odpadowa Slask · Odpady przemyslowe",
|
||||
NewRouteNotificationFormatter.collapsedText(route),
|
||||
)
|
||||
assertTrue(NewRouteNotificationFormatter.expandedText(route).contains("Skąd: TPP Baza Krakow"))
|
||||
assertTrue(NewRouteNotificationFormatter.expandedText(route).contains("Dokąd: Instalacja Odpadowa Slask"))
|
||||
assertTrue(NewRouteNotificationFormatter.expandedText(route).contains("Kontrakt: Odpady przemyslowe"))
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,38 @@ class DriverUiRulesTest {
|
||||
assertEquals(3, inlinePhotoGridRows(5))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun usesShorterChromeOnCompactScreens() {
|
||||
assertEquals(118, authBrandBannerHeightDp(600))
|
||||
assertEquals(150, authBrandBannerHeightDp(690))
|
||||
assertEquals(190, authBrandBannerHeightDp(780))
|
||||
|
||||
assertEquals(92, appBrandHeaderHeightDp(600))
|
||||
assertEquals(108, appBrandHeaderHeightDp(690))
|
||||
assertEquals(124, appBrandHeaderHeightDp(780))
|
||||
|
||||
assertEquals(72, bottomNavigationHeightDp(600))
|
||||
assertEquals(78, bottomNavigationHeightDp(690))
|
||||
assertEquals(82, bottomNavigationHeightDp(780))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun reducesHorizontalSpaceOnNarrowScreens() {
|
||||
assertEquals(14, screenHorizontalPaddingDp(340))
|
||||
assertEquals(16, screenHorizontalPaddingDp(390))
|
||||
assertEquals(20, screenHorizontalPaddingDp(440))
|
||||
|
||||
assertEquals(70, phonePrefixWidthDp(340))
|
||||
assertEquals(82, phonePrefixWidthDp(390))
|
||||
assertEquals(94, phonePrefixWidthDp(440))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun stacksDenseRouteFactsOnNarrowScreens() {
|
||||
assertEquals(1, routeFactColumns(340))
|
||||
assertEquals(2, routeFactColumns(390))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun countsServerPhotosAndLocalUploadsAsVisibleAttachments() {
|
||||
assertEquals(0, visiblePhotoAttachmentCount(serverPhotoCount = 0, localUploadCount = 0))
|
||||
|
||||
Reference in New Issue
Block a user