@@ -1071,6 +1071,112 @@ channels: [1, 2, 3]
10711071 }
10721072}
10731073
1074+ func TestManager_LoadConfigCodeGROOVEProdConfig (t * testing.T ) {
1075+ // Test with actual production config from codeGROOVE-dev/.codeGROOVE/slack.yaml
1076+ prodYAML := `global:
1077+ team_id: T09CJ7X7T7Y
1078+ email_domain: codegroove.dev
1079+ reminder_dm_delay: 1
1080+
1081+ channels:
1082+ goose:
1083+ mute: true
1084+
1085+ all-codegroove:
1086+ repos:
1087+ - "*"
1088+
1089+ social:
1090+ repos:
1091+ - goose
1092+ - sprinkler
1093+ - slacker
1094+ `
1095+
1096+ handler := func (w http.ResponseWriter , r * http.Request ) {
1097+ content := base64 .StdEncoding .EncodeToString ([]byte (prodYAML ))
1098+ encoding := "base64"
1099+ response := github.RepositoryContent {
1100+ Type : github .String ("file" ),
1101+ Content : & content ,
1102+ Encoding : & encoding ,
1103+ }
1104+ w .Header ().Set ("Content-Type" , "application/json" )
1105+ if err := json .NewEncoder (w ).Encode (response ); err != nil {
1106+ t .Errorf ("failed to encode response: %v" , err )
1107+ }
1108+ }
1109+
1110+ client , server := createTestGitHubClient (handler )
1111+ defer server .Close ()
1112+
1113+ m := New ()
1114+ m .SetGitHubClient ("codeGROOVE-dev" , client )
1115+
1116+ ctx := context .Background ()
1117+ err := m .LoadConfig (ctx , "codeGROOVE-dev" )
1118+ if err != nil {
1119+ t .Fatalf ("unexpected error loading production config: %v" , err )
1120+ }
1121+
1122+ // Verify config was loaded correctly
1123+ cfg , exists := m .Config ("codeGROOVE-dev" )
1124+ if ! exists {
1125+ t .Fatal ("expected config to exist after loading" )
1126+ }
1127+ if cfg .Global .TeamID != "T09CJ7X7T7Y" {
1128+ t .Errorf ("expected TeamID T09CJ7X7T7Y, got %q" , cfg .Global .TeamID )
1129+ }
1130+ if cfg .Global .EmailDomain != "codegroove.dev" {
1131+ t .Errorf ("expected email domain codegroove.dev, got %q" , cfg .Global .EmailDomain )
1132+ }
1133+ if cfg .Global .ReminderDMDelay != 1 {
1134+ t .Errorf ("expected reminder delay 1 minute, got %d" , cfg .Global .ReminderDMDelay )
1135+ }
1136+ if len (cfg .Channels ) != 3 {
1137+ t .Errorf ("expected 3 channels, got %d" , len (cfg .Channels ))
1138+ }
1139+
1140+ // Verify goose channel is muted
1141+ gooseChannel , exists := cfg .Channels ["goose" ]
1142+ if ! exists {
1143+ t .Error ("expected goose channel to exist" )
1144+ }
1145+ if ! gooseChannel .Mute {
1146+ t .Error ("expected goose channel to be muted" )
1147+ }
1148+
1149+ // Verify all-codegroove has wildcard
1150+ allChannel , exists := cfg .Channels ["all-codegroove" ]
1151+ if ! exists {
1152+ t .Error ("expected all-codegroove channel to exist" )
1153+ }
1154+ if len (allChannel .Repos ) != 1 || allChannel .Repos [0 ] != "*" {
1155+ t .Errorf ("expected all-codegroove to have wildcard repo, got %v" , allChannel .Repos )
1156+ }
1157+
1158+ // Verify social channel repos
1159+ socialChannel , exists := cfg .Channels ["social" ]
1160+ if ! exists {
1161+ t .Error ("expected social channel to exist" )
1162+ }
1163+ expectedRepos := []string {"goose" , "sprinkler" , "slacker" }
1164+ if len (socialChannel .Repos ) != len (expectedRepos ) {
1165+ t .Errorf ("expected %d repos in social channel, got %d" , len (expectedRepos ), len (socialChannel .Repos ))
1166+ }
1167+ for i , repo := range expectedRepos {
1168+ if i >= len (socialChannel .Repos ) || socialChannel .Repos [i ] != repo {
1169+ t .Errorf ("expected repo %q at index %d in social channel, got %v" , repo , i , socialChannel .Repos )
1170+ }
1171+ }
1172+
1173+ // Verify ReminderDMDelay returns correct value
1174+ delay := m .ReminderDMDelay ("codeGROOVE-dev" , "social" )
1175+ if delay != 1 {
1176+ t .Errorf ("expected ReminderDMDelay to return 1 minute, got %d" , delay )
1177+ }
1178+ }
1179+
10741180func TestManager_LoadConfigEmptyContent (t * testing.T ) {
10751181 handler := func (w http.ResponseWriter , r * http.Request ) {
10761182 // Return a response with nil Content
0 commit comments