2024-07-10 21:17:14 -05:00
|
|
|
import Foundation
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
import Testing
|
2024-07-10 21:17:14 -05:00
|
|
|
|
|
|
|
|
@testable import Meshtastic
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Suite("Router")
|
|
|
|
|
struct RouterTests {
|
2024-07-10 21:17:14 -05:00
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
// MARK: - Initialization
|
|
|
|
|
|
|
|
|
|
@Test func defaultInitialState() async {
|
|
|
|
|
let router = await Router()
|
|
|
|
|
let state = await router.navigationState
|
|
|
|
|
#expect(state.selectedTab == .connect)
|
|
|
|
|
#expect(state.messages == nil)
|
|
|
|
|
#expect(state.nodeListSelectedNodeNum == nil)
|
|
|
|
|
#expect(state.map == nil)
|
|
|
|
|
#expect(state.settings == nil)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func customInitialState() async {
|
|
|
|
|
let custom = NavigationState(selectedTab: .map, map: .waypoint(42))
|
|
|
|
|
let router = await Router(navigationState: custom)
|
|
|
|
|
let state = await router.navigationState
|
|
|
|
|
#expect(state == custom)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - Invalid URL Handling
|
|
|
|
|
|
|
|
|
|
@Test func invalidSchemeIsIgnored() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
let router = await Router()
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
let url = try #require(URL(string: "https:///messages"))
|
|
|
|
|
await router.route(url: url)
|
2024-08-28 07:02:55 -05:00
|
|
|
let tab = await router.navigationState.selectedTab
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
#expect(tab == .connect)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func unknownPathIsIgnored() async throws {
|
|
|
|
|
let router = await Router()
|
|
|
|
|
let url = try #require(URL(string: "meshtastic:///unknown"))
|
|
|
|
|
await router.route(url: url)
|
|
|
|
|
let state = await router.navigationState
|
|
|
|
|
#expect(state == NavigationState(selectedTab: .connect))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - Connect
|
|
|
|
|
|
|
|
|
|
@Test func routeConnect() async throws {
|
|
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///connect",
|
|
|
|
|
NavigationState(selectedTab: .connect)
|
|
|
|
|
)
|
2024-07-10 21:17:14 -05:00
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
// MARK: - Messages
|
|
|
|
|
|
|
|
|
|
@Test func routeMessages() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///messages",
|
|
|
|
|
NavigationState(selectedTab: .messages)
|
|
|
|
|
)
|
2024-07-10 21:17:14 -05:00
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test func routeMessagesWithChannelIdAndMessageId() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
2024-07-10 21:17:14 -05:00
|
|
|
"meshtastic:///messages?channelId=0&messageId=1122334455",
|
2024-08-28 07:02:55 -05:00
|
|
|
NavigationState(
|
|
|
|
|
selectedTab: .messages,
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
messages: .channels(channelId: 0, messageId: 1122334455)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func routeMessagesWithChannelIdOnly() async throws {
|
|
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///messages?channelId=5",
|
|
|
|
|
NavigationState(
|
|
|
|
|
selectedTab: .messages,
|
|
|
|
|
messages: .channels(channelId: 5, messageId: nil)
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
2024-07-10 21:17:14 -05:00
|
|
|
)
|
2024-08-28 07:02:55 -05:00
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test func routeMessagesWithUserNumAndMessageId() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
2024-07-10 21:17:14 -05:00
|
|
|
"meshtastic:///messages?userNum=123456789&messageId=9876543210",
|
2024-08-28 07:02:55 -05:00
|
|
|
NavigationState(
|
|
|
|
|
selectedTab: .messages,
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
messages: .directMessages(userNum: 123456789, messageId: 9876543210)
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test func routeMessagesWithUserNumOnly() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
"meshtastic:///messages?userNum=42",
|
|
|
|
|
NavigationState(
|
|
|
|
|
selectedTab: .messages,
|
|
|
|
|
messages: .directMessages(userNum: 42, messageId: nil)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func routeMessagesWithOnlyMessageIdIgnoresIt() async throws {
|
|
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///messages?messageId=999",
|
|
|
|
|
NavigationState(selectedTab: .messages)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func routeMessagesWithNonNumericParamsIgnoresThem() async throws {
|
|
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///messages?channelId=abc&messageId=xyz",
|
|
|
|
|
NavigationState(selectedTab: .messages)
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
// MARK: - Nodes
|
|
|
|
|
|
|
|
|
|
@Test func routeNodes() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///nodes",
|
|
|
|
|
NavigationState(selectedTab: .nodes)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test func routeNodesWithNodeNum() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///nodes?nodenum=1234567890",
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
NavigationState(selectedTab: .nodes, nodeListSelectedNodeNum: 1234567890)
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test func routeNodesWithNonNumericNodeNum() async throws {
|
|
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///nodes?nodenum=abc",
|
|
|
|
|
NavigationState(selectedTab: .nodes)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - Map
|
|
|
|
|
|
|
|
|
|
@Test func routeMap() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///map",
|
|
|
|
|
NavigationState(selectedTab: .map)
|
2024-07-10 21:17:14 -05:00
|
|
|
)
|
2024-08-28 07:02:55 -05:00
|
|
|
}
|
2024-07-10 21:17:14 -05:00
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test func routeMapWithWaypointId() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///map?waypointId=123456",
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
NavigationState(selectedTab: .map, map: .waypoint(123456))
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
|
|
|
|
}
|
2024-07-10 21:17:14 -05:00
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test func routeMapWithNodeNum() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///map?nodenum=1234567890",
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
NavigationState(selectedTab: .map, map: .selectedNode(1234567890))
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func routeMapWithBothNodeNumAndWaypointIdPrefersNode() async throws {
|
|
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///map?nodenum=111&waypointId=222",
|
|
|
|
|
NavigationState(selectedTab: .map, map: .selectedNode(111))
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func routeMapWithNonNumericParamsIgnoresThem() async throws {
|
|
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///map?nodenum=abc&waypointId=xyz",
|
|
|
|
|
NavigationState(selectedTab: .map)
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
|
|
|
|
}
|
2024-07-10 21:17:14 -05:00
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
// MARK: - Settings
|
|
|
|
|
|
|
|
|
|
@Test func routeSettings() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///settings",
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
NavigationState(selectedTab: .settings)
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test(arguments: [
|
|
|
|
|
("about", SettingsNavigationState.about),
|
|
|
|
|
("appSettings", SettingsNavigationState.appSettings),
|
|
|
|
|
("routes", SettingsNavigationState.routes),
|
|
|
|
|
("routeRecorder", SettingsNavigationState.routeRecorder),
|
|
|
|
|
("lora", SettingsNavigationState.lora),
|
|
|
|
|
("channels", SettingsNavigationState.channels),
|
|
|
|
|
("shareQRCode", SettingsNavigationState.shareQRCode),
|
|
|
|
|
("user", SettingsNavigationState.user),
|
|
|
|
|
("bluetooth", SettingsNavigationState.bluetooth),
|
|
|
|
|
("device", SettingsNavigationState.device),
|
|
|
|
|
("display", SettingsNavigationState.display),
|
|
|
|
|
("network", SettingsNavigationState.network),
|
|
|
|
|
("position", SettingsNavigationState.position),
|
|
|
|
|
("power", SettingsNavigationState.power),
|
|
|
|
|
("ambientLighting", SettingsNavigationState.ambientLighting),
|
|
|
|
|
("cannedMessages", SettingsNavigationState.cannedMessages),
|
|
|
|
|
("detectionSensor", SettingsNavigationState.detectionSensor),
|
|
|
|
|
("externalNotification", SettingsNavigationState.externalNotification),
|
|
|
|
|
("mqtt", SettingsNavigationState.mqtt),
|
|
|
|
|
("rangeTest", SettingsNavigationState.rangeTest),
|
|
|
|
|
("paxCounter", SettingsNavigationState.paxCounter),
|
|
|
|
|
("ringtone", SettingsNavigationState.ringtone),
|
|
|
|
|
("serial", SettingsNavigationState.serial),
|
|
|
|
|
("security", SettingsNavigationState.security),
|
|
|
|
|
("storeAndForward", SettingsNavigationState.storeAndForward),
|
|
|
|
|
("telemetry", SettingsNavigationState.telemetry),
|
|
|
|
|
("debugLogs", SettingsNavigationState.debugLogs),
|
|
|
|
|
("appFiles", SettingsNavigationState.appFiles),
|
|
|
|
|
("firmwareUpdates", SettingsNavigationState.firmwareUpdates),
|
|
|
|
|
("tak", SettingsNavigationState.tak),
|
|
|
|
|
])
|
|
|
|
|
func routeSettingsPage(path: String, expected: SettingsNavigationState) async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
"meshtastic:///settings/\(path)",
|
|
|
|
|
NavigationState(selectedTab: .settings, settings: expected)
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
|
|
|
|
}
|
2024-07-10 21:17:14 -05:00
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
@Test func routeSettingsInvalidSetting() async throws {
|
2024-08-28 07:02:55 -05:00
|
|
|
try await assertRoute(
|
|
|
|
|
"meshtastic:///settings/invalidSetting",
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
NavigationState(selectedTab: .settings)
|
2024-08-28 07:02:55 -05:00
|
|
|
)
|
2024-07-10 21:17:14 -05:00
|
|
|
}
|
|
|
|
|
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
// MARK: - navigateToNodeDetail
|
|
|
|
|
|
|
|
|
|
@Test func navigateToNodeDetail() async {
|
|
|
|
|
let router = await Router()
|
|
|
|
|
await router.navigateToNodeDetail(nodeNum: 9876543210)
|
|
|
|
|
let state = await router.navigationState
|
|
|
|
|
#expect(state.selectedTab == .nodes)
|
|
|
|
|
#expect(state.nodeListSelectedNodeNum == 9876543210)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - State Transitions
|
|
|
|
|
|
|
|
|
|
@Test func routingToNewTabClearsPreviousState() async throws {
|
|
|
|
|
let router = await Router()
|
|
|
|
|
|
|
|
|
|
// First, route to messages with channel state
|
|
|
|
|
let messagesURL = try #require(URL(string: "meshtastic:///messages?channelId=1&messageId=100"))
|
|
|
|
|
await router.route(url: messagesURL)
|
|
|
|
|
let messagesState = await router.navigationState
|
|
|
|
|
#expect(messagesState.selectedTab == .messages)
|
|
|
|
|
#expect(messagesState.messages != nil)
|
|
|
|
|
|
|
|
|
|
// Then route to map — messages state should remain but tab changes
|
|
|
|
|
let mapURL = try #require(URL(string: "meshtastic:///map?waypointId=42"))
|
|
|
|
|
await router.route(url: mapURL)
|
|
|
|
|
let mapState = await router.navigationState
|
|
|
|
|
#expect(mapState.selectedTab == .map)
|
|
|
|
|
#expect(mapState.map == .waypoint(42))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func consecutiveRoutesUpdateState() async throws {
|
|
|
|
|
let router = await Router()
|
|
|
|
|
|
|
|
|
|
let nodesURL = try #require(URL(string: "meshtastic:///nodes?nodenum=111"))
|
|
|
|
|
await router.route(url: nodesURL)
|
|
|
|
|
let first = await router.navigationState
|
|
|
|
|
#expect(first.selectedTab == .nodes)
|
|
|
|
|
#expect(first.nodeListSelectedNodeNum == 111)
|
|
|
|
|
|
|
|
|
|
let nodesURL2 = try #require(URL(string: "meshtastic:///nodes?nodenum=222"))
|
|
|
|
|
await router.route(url: nodesURL2)
|
|
|
|
|
let second = await router.navigationState
|
|
|
|
|
#expect(second.selectedTab == .nodes)
|
|
|
|
|
#expect(second.nodeListSelectedNodeNum == 222)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func invalidSchemeDoesNotMutateExistingState() async throws {
|
|
|
|
|
let initial = NavigationState(selectedTab: .map, map: .waypoint(99))
|
|
|
|
|
let router = await Router(navigationState: initial)
|
|
|
|
|
let badURL = try #require(URL(string: "https:///messages"))
|
|
|
|
|
await router.route(url: badURL)
|
|
|
|
|
let state = await router.navigationState
|
|
|
|
|
#expect(state == initial)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - Helpers
|
|
|
|
|
|
2024-07-10 21:17:14 -05:00
|
|
|
private func assertRoute(
|
|
|
|
|
_ urlString: String,
|
|
|
|
|
_ destination: NavigationState
|
2024-08-28 07:02:55 -05:00
|
|
|
) async throws {
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
let router = await Router()
|
|
|
|
|
let url = try #require(URL(string: urlString))
|
2024-08-28 07:02:55 -05:00
|
|
|
await router.route(url: url)
|
|
|
|
|
let state = await router.navigationState
|
Migrate test project to Swift Testing and add connect view and router tests (#1643)
* Migrate to Swift Testing and add connect view tests
- Convert RouterTests.swift from XCTest to Swift Testing (@Suite, @Test, #expect, #require)
- Create ConnectViewTests.swift with tests for connect view child types:
- Device struct (creation, signal strength, RSSI, description, codable)
- TransportType enum (cases, raw values, codable)
- ConnectionState enum (equality, codable)
- BLESignalStrength enum (raw values, init)
- TransportStatus enum (equality)
- NavigationState (defaults, tabs, sub-states)
- InvalidVersion view (creation with versions)
- ConnectedDevice view (connected/disconnected/MQTT states)
- CircleText view (default/custom sizes, emoji)
- BatteryCompact view (levels, nil, charging, plugged in)
- SignalStrengthIndicator view (dimensions, strength levels)
- Update Xcode project to include new test file
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/d7bb7a89-2105-4fcb-96bc-7ec794467c74
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Fix signal strength test boundary conditions
The getSignalStrength() method uses NSNumber.compare(.orderedDescending),
which is a strict greater-than check. Fix the boundary test cases:
- RSSI -65 is .normal (not .strong), since -65 is not > -65
- RSSI -85 is .weak (not .normal), since -85 is not > -85
- Add -64 → .strong and -84 → .normal as adjacent boundary tests
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/4fcbc01e-cbea-4d11-b2c0-e923c6730d69
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Improve and complete router tests with comprehensive coverage
Added tests for:
- Custom initial state
- Invalid scheme / unknown path handling (state unchanged)
- navigateToNodeDetail public method
- Messages edge cases: channelId only, userNum only, messageId only, non-numeric params
- Nodes with non-numeric nodenum
- Map with both nodenum+waypointId (nodeId priority), non-numeric params
- Parameterized settings test covering all 31 SettingsNavigationState cases
- State transitions: consecutive routes, invalid scheme preserves existing state
Agent-Logs-Url: https://github.com/meshtastic/Meshtastic-Apple/sessions/f69b7352-21aa-494c-8864-31fc0f4b21b8
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
* Localizable update
* Merge translations file
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Co-authored-by: Garth Vander Houwen <garthvh@yahoo.com>
2026-04-01 18:55:59 -07:00
|
|
|
#expect(state == destination)
|
2024-07-10 21:17:14 -05:00
|
|
|
}
|
|
|
|
|
}
|