mirror of
https://github.com/home-assistant/iOS.git
synced 2025-12-10 13:22:23 -06:00
Add test coverage for openEntityDeeplinkURL empty path behavior (#4053)
## Summary Adds test coverage for `openEntityDeeplinkURL` to verify the URL generation with empty navigation path (`navigate/?`) and `more-info-entity-id` query parameter. This documents the expected behavior and prevents regressions from the path change in PR #4052. The test validates: - Empty path results in `navigate/?` format - Query parameters include `more-info-entity-id`, `server`, `avoidUnecessaryReload`, and `isComingFromAppIntent` ## Screenshots N/A - test-only change ## Link to pull request in Documentation repository Documentation: home-assistant/companion.home-assistant# ## Any other notes This PR merges into #4052 as part of the stacked PR workflow to address review feedback. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: Bruno Pantaleão <5808343+bgoncal@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
parent
0bb92dc9da
commit
e501125eec
@ -49,4 +49,26 @@ struct AppConstantsTests {
|
||||
assert(AppConstants.QueryItems.openMoreInfoDialog.rawValue == "more-info-entity-id")
|
||||
assert(AppConstants.QueryItems.isComingFromAppIntent.rawValue == "isComingFromAppIntent")
|
||||
}
|
||||
|
||||
@Test func testOpenEntityDeeplinkURL() async throws {
|
||||
let entityId = "light.living_room"
|
||||
let serverId = "server123"
|
||||
let result = AppConstants.openEntityDeeplinkURL(entityId: entityId, serverId: serverId)?.absoluteString
|
||||
|
||||
// Verify the URL contains empty path (navigate/?) and correct query params
|
||||
assert(result?.contains("navigate/?") == true, "URL should contain navigate/? with empty path")
|
||||
assert(
|
||||
result?.contains("more-info-entity-id=\(entityId)") == true,
|
||||
"URL should contain more-info-entity-id query parameter"
|
||||
)
|
||||
assert(result?.contains("server=\(serverId)") == true, "URL should contain server query parameter")
|
||||
assert(
|
||||
result?.contains("avoidUnecessaryReload=true") == true,
|
||||
"URL should contain avoidUnecessaryReload=true"
|
||||
)
|
||||
assert(
|
||||
result?.contains("isComingFromAppIntent=true") == true,
|
||||
"URL should contain isComingFromAppIntent=true"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user