test: add edge case coverage for nonexistent groupId in GroupSelection
Verify that subtreeIds returns empty set and toggling returns current unchanged when groupId is not found in the tree. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WYqycDFsynHH9VnnK7LNSf
This commit is contained in:
@@ -39,4 +39,19 @@ final class GroupSelectionTests: XCTestCase {
|
||||
let result = GroupSelection.toggling(work.id, in: root, current: [personal.id])
|
||||
XCTAssertEqual(result, [personal.id, work.id, email.id])
|
||||
}
|
||||
|
||||
func test_subtreeIds_groupNotFound_returnsEmptySet() {
|
||||
let (root, _, _, _) = makeSampleTree()
|
||||
let nonExistentId = UUID()
|
||||
let ids = GroupSelection.subtreeIds(of: nonExistentId, in: root)
|
||||
XCTAssertEqual(ids, [])
|
||||
}
|
||||
|
||||
func test_toggling_groupNotFound_returnsCurrentUnchanged() {
|
||||
let (root, _, _, personal) = makeSampleTree()
|
||||
let nonExistentId = UUID()
|
||||
let current: Set<UUID> = [personal.id]
|
||||
let result = GroupSelection.toggling(nonExistentId, in: root, current: current)
|
||||
XCTAssertEqual(result, current)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user