mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-02-02 20:02:26 -05:00
make channel unit tests
This commit is contained in:
22
app/src/androidTest/java/com/geeksville/mesh/ChannelTest.kt
Normal file
22
app/src/androidTest/java/com/geeksville/mesh/ChannelTest.kt
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.geeksville.mesh
|
||||
|
||||
|
||||
import androidx.compose.frames.open
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.geeksville.mesh.model.Channel
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ChannelTest {
|
||||
@Test
|
||||
fun channelUrlGood() {
|
||||
open() // Needed to make Compose think we are inside a Frame
|
||||
val ch = Channel.emulated
|
||||
|
||||
Assert.assertTrue(ch.getChannelUrl().toString().startsWith(Channel.prefix))
|
||||
Assert.assertEquals(Channel(ch.getChannelUrl()), ch)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.geeksville.mesh
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
@@ -19,6 +17,6 @@ class ExampleInstrumentedTest {
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.geeksville.com.geeksville.mesh", appContext.packageName)
|
||||
assertEquals("com.geeksville.mesh", appContext.packageName)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user