Skip to content

Commit 077c532

Browse files
author
LittleCoinCoin
committed
test: add comprehensive test suite for environment-scoped commands
Add command specification alignment tests: - Test environment-scoped list hosts functionality - Test CLI argument parsing for --env and --detailed flags - Test environment manager integration and validation - Test discover hosts unchanged behavior validation Add environment tracking synchronization tests: - Test remove_package_host_configuration() method - Test clear_host_from_all_packages_all_envs() method - Test apply_restored_host_configuration_to_environments() method - Test CLI integration with environment tracking - Test exception handling and error scenarios Add test fixture data: - Environment host configuration scenarios - Host synchronization test scenarios - Multi-environment and multi-host test cases Achieves 100% test pass rate for new implementation
1 parent d098b0b commit 077c532

File tree

4 files changed

+775
-30
lines changed

4 files changed

+775
-30
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"single_host_environment": {
3+
"packages": [
4+
{
5+
"name": "weather-toolkit",
6+
"configured_hosts": {
7+
"claude-desktop": {
8+
"config_path": "~/.claude/config.json",
9+
"configured_at": "2025-09-25T10:00:00",
10+
"last_synced": "2025-09-25T10:00:00"
11+
}
12+
}
13+
}
14+
]
15+
},
16+
"multi_host_environment": {
17+
"packages": [
18+
{
19+
"name": "weather-toolkit",
20+
"configured_hosts": {
21+
"claude-desktop": {
22+
"config_path": "~/.claude/config.json",
23+
"configured_at": "2025-09-25T10:00:00",
24+
"last_synced": "2025-09-25T10:00:00"
25+
},
26+
"cursor": {
27+
"config_path": "~/.cursor/config.json",
28+
"configured_at": "2025-09-25T10:30:00",
29+
"last_synced": "2025-09-25T10:30:00"
30+
}
31+
}
32+
},
33+
{
34+
"name": "team-utilities",
35+
"configured_hosts": {
36+
"claude-desktop": {
37+
"config_path": "~/.claude/config.json",
38+
"configured_at": "2025-09-25T11:00:00",
39+
"last_synced": "2025-09-25T11:00:00"
40+
}
41+
}
42+
}
43+
]
44+
},
45+
"empty_environment": {
46+
"packages": []
47+
},
48+
"packages_no_host_tracking": {
49+
"packages": [
50+
{
51+
"name": "legacy-package"
52+
},
53+
{
54+
"name": "another-legacy-package",
55+
"configured_hosts": {}
56+
}
57+
]
58+
}
59+
}
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
{
2+
"remove_server_scenario": {
3+
"before": {
4+
"environment": "project-alpha",
5+
"packages": [
6+
{
7+
"name": "weather-toolkit",
8+
"configured_hosts": {
9+
"claude-desktop": {
10+
"config_path": "~/.claude/config.json",
11+
"configured_at": "2025-09-25T10:00:00",
12+
"last_synced": "2025-09-25T10:00:00"
13+
},
14+
"cursor": {
15+
"config_path": "~/.cursor/config.json",
16+
"configured_at": "2025-09-25T10:30:00",
17+
"last_synced": "2025-09-25T10:30:00"
18+
}
19+
}
20+
}
21+
]
22+
},
23+
"after": {
24+
"packages": [
25+
{
26+
"name": "weather-toolkit",
27+
"configured_hosts": {
28+
"claude-desktop": {
29+
"config_path": "~/.claude/config.json",
30+
"configured_at": "2025-09-25T10:00:00",
31+
"last_synced": "2025-09-25T10:00:00"
32+
}
33+
}
34+
}
35+
]
36+
}
37+
},
38+
"remove_host_scenario": {
39+
"multi_environment_before": {
40+
"project-alpha": {
41+
"packages": [
42+
{
43+
"name": "weather-toolkit",
44+
"configured_hosts": {
45+
"claude-desktop": {
46+
"config_path": "~/.claude/config.json",
47+
"configured_at": "2025-09-25T10:00:00"
48+
},
49+
"cursor": {
50+
"config_path": "~/.cursor/config.json",
51+
"configured_at": "2025-09-25T10:30:00"
52+
}
53+
}
54+
}
55+
]
56+
},
57+
"project-beta": {
58+
"packages": [
59+
{
60+
"name": "team-utilities",
61+
"configured_hosts": {
62+
"cursor": {
63+
"config_path": "~/.cursor/config.json",
64+
"configured_at": "2025-09-25T11:00:00"
65+
}
66+
}
67+
}
68+
]
69+
}
70+
},
71+
"multi_environment_after": {
72+
"project-alpha": {
73+
"packages": [
74+
{
75+
"name": "weather-toolkit",
76+
"configured_hosts": {
77+
"claude-desktop": {
78+
"config_path": "~/.claude/config.json",
79+
"configured_at": "2025-09-25T10:00:00"
80+
}
81+
}
82+
}
83+
]
84+
},
85+
"project-beta": {
86+
"packages": [
87+
{
88+
"name": "team-utilities",
89+
"configured_hosts": {}
90+
}
91+
]
92+
}
93+
}
94+
},
95+
"restore_backup_scenario": {
96+
"environment_before": {
97+
"packages": [
98+
{
99+
"name": "old-server",
100+
"configured_hosts": {
101+
"claude-desktop": {
102+
"config_path": "~/.claude/config.json",
103+
"configured_at": "2025-09-25T09:00:00",
104+
"last_synced": "2025-09-25T09:00:00"
105+
}
106+
}
107+
},
108+
{
109+
"name": "weather-toolkit",
110+
"configured_hosts": {
111+
"claude-desktop": {
112+
"config_path": "~/.claude/config.json",
113+
"configured_at": "2025-09-25T09:30:00",
114+
"last_synced": "2025-09-25T09:30:00"
115+
}
116+
}
117+
}
118+
]
119+
},
120+
"restored_servers": {
121+
"new-server": {
122+
"command": "python -m new_server",
123+
"args": ["--port", "8080"]
124+
},
125+
"weather-toolkit": {
126+
"command": "python -m weather_toolkit",
127+
"args": ["--api-key", "test"]
128+
}
129+
},
130+
"environment_after": {
131+
"packages": [
132+
{
133+
"name": "new-server",
134+
"configured_hosts": {
135+
"claude-desktop": {
136+
"config_path": "~/.claude/config.json",
137+
"configured_at": "2025-09-25T12:00:00",
138+
"last_synced": "2025-09-25T12:00:00",
139+
"server_config": {
140+
"command": "python -m new_server",
141+
"args": ["--port", "8080"]
142+
}
143+
}
144+
}
145+
},
146+
{
147+
"name": "weather-toolkit",
148+
"configured_hosts": {
149+
"claude-desktop": {
150+
"config_path": "~/.claude/config.json",
151+
"configured_at": "2025-09-25T09:30:00",
152+
"last_synced": "2025-09-25T12:00:00",
153+
"server_config": {
154+
"command": "python -m weather_toolkit",
155+
"args": ["--api-key", "test"]
156+
}
157+
}
158+
}
159+
}
160+
]
161+
}
162+
}
163+
}

0 commit comments

Comments
 (0)