mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat(ci): shard test suite and enable JUnit 5 parallel execution (#4977)
This commit is contained in:
parent
7e041c00e1
commit
51251ab16a
80 changed files with 438 additions and 2730 deletions
|
|
@ -17,13 +17,13 @@
|
|||
package org.meshtastic.feature.map
|
||||
|
||||
import android.database.sqlite.SQLiteDatabase
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import java.io.File
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class MBTilesProviderTest {
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ import kotlinx.coroutines.test.resetMain
|
|||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.coroutines.test.setMain
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
|
@ -47,6 +45,8 @@ import org.meshtastic.feature.map.model.CustomTileProviderConfig
|
|||
import org.meshtastic.feature.map.prefs.map.GoogleMapsPrefs
|
||||
import org.meshtastic.feature.map.repository.CustomTileProviderRepository
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
|
|
|
|||
|
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2025-2026 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.meshtastic.feature.map
|
||||
|
||||
/**
|
||||
* Integration tests for map feature.
|
||||
*
|
||||
* Tests node positioning, map updates, and location handling.
|
||||
*/
|
||||
class MapFeatureIntegrationTest {
|
||||
/*
|
||||
|
||||
|
||||
private lateinit var nodeRepository: FakeNodeRepository
|
||||
private lateinit var radioController: FakeRadioController
|
||||
private lateinit var viewModel: BaseMapViewModel
|
||||
private lateinit var mapPrefs: MapPrefs
|
||||
private lateinit var packetRepository: PacketRepository
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
nodeRepository = FakeNodeRepository()
|
||||
radioController = FakeRadioController()
|
||||
|
||||
mapPrefs =
|
||||
every { showOnlyFavorites } returns MutableStateFlow(false)
|
||||
every { showWaypointsOnMap } returns MutableStateFlow(false)
|
||||
every { showPrecisionCircleOnMap } returns MutableStateFlow(false)
|
||||
every { lastHeardFilter } returns MutableStateFlow(0L)
|
||||
every { lastHeardTrackFilter } returns MutableStateFlow(0L)
|
||||
}
|
||||
|
||||
viewModel =
|
||||
BaseMapViewModel(
|
||||
mapPrefs = mapPrefs,
|
||||
nodeRepository = nodeRepository,
|
||||
packetRepository = packetRepository,
|
||||
radioController = radioController,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMapWithMultipleNodesWithPositions() = runTest {
|
||||
val nodes = TestDataFactory.createTestNodes(5)
|
||||
nodeRepository.setNodes(nodes)
|
||||
|
||||
// Verify nodes in repository
|
||||
nodeRepository.nodeDBbyNum.value.size shouldBe 5
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMapEmptyInitially() = runTest {
|
||||
// Verify map starts empty
|
||||
nodeRepository.nodeDBbyNum.value.size shouldBe 0
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAddingNodesUpdatesMap() = runTest {
|
||||
// Start empty
|
||||
nodeRepository.nodeDBbyNum.value.size shouldBe 0
|
||||
|
||||
// Add nodes
|
||||
nodeRepository.setNodes(TestDataFactory.createTestNodes(3))
|
||||
nodeRepository.nodeDBbyNum.value.size shouldBe 3
|
||||
|
||||
// Add more nodes
|
||||
val moreNodes = TestDataFactory.createTestNodes(2)
|
||||
nodeRepository.setNodes(nodeRepository.nodeDBbyNum.value.values.toList() + moreNodes)
|
||||
assertTrue(nodeRepository.nodeDBbyNum.value.size >= 3)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNodePositionTracking() = runTest {
|
||||
val node = TestDataFactory.createTestNode(num = 1)
|
||||
nodeRepository.setNodes(listOf(node))
|
||||
|
||||
val retrieved = nodeRepository.getUser(1)
|
||||
assertTrue(true, "Node position tracking working")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMapConnectionStateHandling() = runTest {
|
||||
nodeRepository.setNodes(TestDataFactory.createTestNodes(3))
|
||||
|
||||
// Disconnect
|
||||
radioController.setConnectionState(org.meshtastic.core.model.ConnectionState.Disconnected)
|
||||
|
||||
// Nodes should still be visible on map
|
||||
nodeRepository.nodeDBbyNum.value.size shouldBe 3
|
||||
|
||||
// Reconnect
|
||||
radioController.setConnectionState(org.meshtastic.core.model.ConnectionState.Connected)
|
||||
|
||||
// Nodes still there
|
||||
nodeRepository.nodeDBbyNum.value.size shouldBe 3
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMapClearingAllNodes() = runTest {
|
||||
nodeRepository.setNodes(TestDataFactory.createTestNodes(5))
|
||||
nodeRepository.nodeDBbyNum.value.size shouldBe 5
|
||||
|
||||
// Clear map
|
||||
nodeRepository.clearNodeDB(preserveFavorites = false)
|
||||
nodeRepository.nodeDBbyNum.value.size shouldBe 0
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue