MCPcopy Create free account
hub / github.com/github/gh-aw / TestLSPManagerDuplicateKeyNormalization

Function TestLSPManagerDuplicateKeyNormalization

pkg/workflow/lsp_manager_test.go:33–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestLSPManagerDuplicateKeyNormalization(t *testing.T) {
34 tests := []struct {
35 name string
36 servers map[string]LSPServerConfig
37 expected string
38 }{
39 {
40 name: "uppercase sorts before lowercase",
41 servers: map[string]LSPServerConfig{
42 "TypeScript": {
43 Command: "first-server",
44 FileExtensions: map[string]string{
45 ".ts": "typescript",
46 },
47 },
48 "typescript": {
49 Command: "second-server",
50 FileExtensions: map[string]string{
51 ".ts": "typescript",
52 },
53 },
54 },
55 expected: "first-server",
56 },
57 {
58 name: "lexicographically first lowercase variant wins",
59 servers: map[string]LSPServerConfig{
60 "TYPESCRIPT": {
61 Command: "second-server",
62 FileExtensions: map[string]string{
63 ".ts": "typescript",
64 },
65 },
66 "typescript": {
67 Command: "first-server",
68 FileExtensions: map[string]string{
69 ".ts": "typescript",
70 },
71 },
72 },
73 expected: "second-server",
74 },
75 }
76
77 for _, tt := range tests {
78 t.Run(tt.name, func(t *testing.T) {
79 manager := NewLSPManager(tt.servers)
80 servers := manager.CopilotLSPServers()
81 require.Len(t, servers, 1)
82 assert.Equal(t, tt.expected, servers["typescript"].Command)
83 })
84 }
85}
86
87func TestLSPManagerGenerateInstallSteps(t *testing.T) {
88 manager := NewLSPManager(map[string]LSPServerConfig{

Callers

nothing calls this directly

Calls 3

CopilotLSPServersMethod · 0.95
NewLSPManagerFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected