Alter tests to match new behavior

This commit is contained in:
TPJ Schikhof
2025-12-09 19:36:26 +01:00
parent 8b5be7b43e
commit 7e93ee12c8

View File

@@ -25,6 +25,7 @@ class PingPluginTest {
val context = mockk<Context> {
every { getSharedPreferences(any(), any()) } returns mockk<SharedPreferences>()
every { getSystemService(any()) } returns notificationManager
every { getString(any()) } returns "STRING"
}
val device = mockk<Device> {
every { name } returns "Test Device"
@@ -38,7 +39,6 @@ class PingPluginTest {
mockkConstructor(NotificationCompat.Builder::class)
every { anyConstructed<NotificationCompat.Builder>().build() } returns mockk()
plugin.setContext(context, device)
test(device, plugin, notificationManager)
}
}
@@ -47,8 +47,8 @@ class PingPluginTest {
@Test
fun startPlugin() {
executeWithMocks { device, plugin, notificationManager ->
plugin.startMainActivity(mockk())
val entries = plugin.getUiMenuEntries()
entries.single().onClick(mockk())
verify(exactly = 1) { device.sendPacket(match { np -> np.type == "kdeconnect.ping" && np.payload == null }) }
}
}