@@ -2,6 +2,7 @@ package registry
22
33import (
44 "runtime"
5+ "strings"
56 "testing"
67)
78
@@ -199,3 +200,48 @@ func TestOllamaDoesNotRequireAuth(t *testing.T) {
199200 t .Error ("Ollama should not require authentication" )
200201 }
201202}
203+
204+ func TestClaudePackageNameConsistency (t * testing.T ) {
205+ agent , err := GetByName ("Claude" )
206+ if err != nil {
207+ t .Fatalf ("Failed to get Claude agent: %v" , err )
208+ }
209+
210+ expectedPackage := "@anthropic-ai/claude-code"
211+ wrongPackage := "@anthropic-ai/claude-cli"
212+
213+ // Verify package_name field
214+ if agent .PackageName != expectedPackage {
215+ t .Errorf ("Expected package_name '%s', got '%s'" , expectedPackage , agent .PackageName )
216+ }
217+
218+ // Verify all install commands use the correct package
219+ verifyCommandMap (t , agent .Install , "Install" , expectedPackage , wrongPackage )
220+
221+ // Verify all uninstall commands use the correct package
222+ verifyCommandMap (t , agent .Uninstall , "Uninstall" , expectedPackage , "" )
223+
224+ // Verify all upgrade commands use the correct package
225+ verifyCommandMap (t , agent .Upgrade , "Upgrade" , expectedPackage , "" )
226+ }
227+
228+ // verifyCommandMap checks that commands in a map contain the expected package
229+ func verifyCommandMap (t * testing.T , commands map [string ]string , cmdType , expectedPkg , wrongPkg string ) {
230+ t .Helper ()
231+ for os , cmd := range commands {
232+ if shouldSkipCommand (cmd ) {
233+ continue
234+ }
235+ if ! strings .Contains (cmd , expectedPkg ) {
236+ t .Errorf ("%s command for %s doesn't contain expected package '%s': %s" , cmdType , os , expectedPkg , cmd )
237+ }
238+ if wrongPkg != "" && strings .Contains (cmd , wrongPkg ) {
239+ t .Errorf ("%s command for %s contains incorrect package '%s': %s" , cmdType , os , wrongPkg , cmd )
240+ }
241+ }
242+ }
243+
244+ // shouldSkipCommand returns true if the command should be skipped in verification
245+ func shouldSkipCommand (cmd string ) bool {
246+ return cmd == "" || (len (cmd ) >= 3 && cmd [:3 ] == "See" )
247+ }
0 commit comments