Skip to content

Commit 4a5d1bb

Browse files
authored
Merge pull request #13 from tstromberg/main
add more test coverage
2 parents 624db2a + 9f8695e commit 4a5d1bb

10 files changed

Lines changed: 1590 additions & 9 deletions

File tree

cmd/server/interfaces.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
import (
4+
"context"
5+
6+
"github.com/codeGROOVE-dev/discordian/internal/discord"
7+
"github.com/codeGROOVE-dev/discordian/internal/github"
8+
)
9+
10+
// GitHubManager defines GitHub operations needed by the server.
11+
type GitHubManager interface {
12+
RefreshInstallations(ctx context.Context) error
13+
AllOrgs() []string
14+
ClientForOrg(org string) (*github.OrgClient, bool)
15+
AppClient() *github.AppClient
16+
}
17+
18+
// DiscordGuildManager defines Discord guild management operations.
19+
type DiscordGuildManager interface {
20+
RegisterClient(guildID string, client *discord.Client)
21+
}

cmd/server/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ func run(ctx context.Context, cancel context.CancelFunc) int {
174174
return 0
175175
}
176176

177-
// configAdapter adapts config.Manager to usermapping.ReverseConfigLookup.
177+
// configAdapter adapts bot.ConfigManager to usermapping.ReverseConfigLookup.
178178
type configAdapter struct {
179-
mgr *config.Manager
179+
mgr bot.ConfigManager
180180
}
181181

182182
func (ca *configAdapter) Config(org string) (usermapping.OrgConfig, bool) {
@@ -194,11 +194,11 @@ type coordinatorManager struct {
194194
notifyMgr *notify.Manager
195195
reverseMapper *usermapping.ReverseMapper
196196
active map[string]context.CancelFunc
197-
guildManager *discord.GuildManager
197+
guildManager DiscordGuildManager
198198
failed map[string]time.Time
199199
coordinators map[string]*bot.Coordinator
200-
configManager *config.Manager
201-
githubManager *github.Manager
200+
configManager bot.ConfigManager
201+
githubManager GitHubManager
202202
cfg config.ServerConfig
203203
dmsSent int64
204204
dailyReports int64

0 commit comments

Comments
 (0)