mirror of
https://invent.kde.org/network/kdeconnect-android.git
synced 2025-12-12 20:35:58 +01:00
Alter tests to match new behavior
This commit is contained in:
@@ -25,6 +25,7 @@ class PingPluginTest {
|
|||||||
val context = mockk<Context> {
|
val context = mockk<Context> {
|
||||||
every { getSharedPreferences(any(), any()) } returns mockk<SharedPreferences>()
|
every { getSharedPreferences(any(), any()) } returns mockk<SharedPreferences>()
|
||||||
every { getSystemService(any()) } returns notificationManager
|
every { getSystemService(any()) } returns notificationManager
|
||||||
|
every { getString(any()) } returns "STRING"
|
||||||
}
|
}
|
||||||
val device = mockk<Device> {
|
val device = mockk<Device> {
|
||||||
every { name } returns "Test Device"
|
every { name } returns "Test Device"
|
||||||
@@ -38,7 +39,6 @@ class PingPluginTest {
|
|||||||
mockkConstructor(NotificationCompat.Builder::class)
|
mockkConstructor(NotificationCompat.Builder::class)
|
||||||
every { anyConstructed<NotificationCompat.Builder>().build() } returns mockk()
|
every { anyConstructed<NotificationCompat.Builder>().build() } returns mockk()
|
||||||
plugin.setContext(context, device)
|
plugin.setContext(context, device)
|
||||||
|
|
||||||
test(device, plugin, notificationManager)
|
test(device, plugin, notificationManager)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,8 +47,8 @@ class PingPluginTest {
|
|||||||
@Test
|
@Test
|
||||||
fun startPlugin() {
|
fun startPlugin() {
|
||||||
executeWithMocks { device, plugin, notificationManager ->
|
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 }) }
|
verify(exactly = 1) { device.sendPacket(match { np -> np.type == "kdeconnect.ping" && np.payload == null }) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user