- Fix subprocess_helper_command_str to use Process.spawn_command_line_sync (line 148) - Improve comment for fetch_subscriptions_needing_sync placeholder (line 303) These fixes address issues identified in code review for FRE-531.
61 lines
1.8 KiB
Kotlin
61 lines
1.8 KiB
Kotlin
package com.rssuper.services
|
|
|
|
import com.rssuper.models.NotificationPreferences
|
|
import org.junit.Assert.assertEquals
|
|
import org.junit.Assert.assertFalse
|
|
import org.junit.Assert.assertNotNull
|
|
import org.junit.Assert.assertTrue
|
|
import org.junit.Test
|
|
|
|
class NotificationServiceTest {
|
|
|
|
@Test
|
|
fun testNotificationPreferencesDefaultValues() {
|
|
val preferences = NotificationPreferences()
|
|
|
|
assertEquals(true, preferences.newArticles)
|
|
assertEquals(true, preferences.episodeReleases)
|
|
assertEquals(false, preferences.customAlerts)
|
|
assertEquals(true, preferences.badgeCount)
|
|
assertEquals(true, preferences.sound)
|
|
assertEquals(true, preferences.vibration)
|
|
}
|
|
|
|
@Test
|
|
fun testNotificationPreferencesCopy() {
|
|
val original = NotificationPreferences(
|
|
newArticles = true,
|
|
sound = true
|
|
)
|
|
|
|
val modified = original.copy(newArticles = false, sound = false)
|
|
|
|
assertEquals(false, modified.newArticles)
|
|
assertEquals(false, modified.sound)
|
|
assertEquals(true, modified.episodeReleases)
|
|
}
|
|
|
|
@Test
|
|
fun testNotificationPreferencesEquals() {
|
|
val pref1 = NotificationPreferences(newArticles = true, sound = true)
|
|
val pref2 = NotificationPreferences(newArticles = true, sound = true)
|
|
val pref3 = NotificationPreferences(newArticles = false, sound = true)
|
|
|
|
assertEquals(pref1, pref2)
|
|
assert(pref1 != pref3)
|
|
}
|
|
|
|
@Test
|
|
fun testNotificationPreferencesToString() {
|
|
val preferences = NotificationPreferences(
|
|
newArticles = true,
|
|
sound = true
|
|
)
|
|
|
|
val toString = preferences.toString()
|
|
assertNotNull(toString)
|
|
assertTrue(toString.contains("newArticles"))
|
|
assertTrue(toString.contains("sound"))
|
|
}
|
|
}
|