Documentation
¶
Index ¶
- func APIPath(rawURL string) string
- type Handler
- type MockSession
- func (ms *MockSession) Close()
- func (ms *MockSession) On(pathPrefix string, handler Handler)
- func (ms *MockSession) WithBotUser(userID, username string) *MockSession
- func (ms *MockSession) WithChannel(ch *discordgo.Channel) *MockSession
- func (ms *MockSession) WithGuild(guild *discordgo.Guild) *MockSession
- func (ms *MockSession) WithMember(guildID string, member *discordgo.Member) *MockSession
- type MongoContainer
- type TBF
- type TestReporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIPath ¶
APIPath extracts the Discord API path portion from a full URL. For example, "https://discord.com/api/v9/channels/123" -> "/channels/123"
Types ¶
type MockSession ¶
func NewSession ¶
func NewSession(t TestReporter) *MockSession
NewSession creates a MockSession with a pre-configured discordgo.Session. The session's State is initialized from NewState() and must be populated by the caller using the Bot helper methods (GuildAdd, MemberAdd, etc.) or by calling WithGuild/WithMember.
The session's HTTP client is wired to an httptest.Server whose behavior is controlled by the Handlers map.
func (*MockSession) Close ¶
func (ms *MockSession) Close()
func (*MockSession) On ¶
func (ms *MockSession) On(pathPrefix string, handler Handler)
func (*MockSession) WithBotUser ¶
func (ms *MockSession) WithBotUser(userID, username string) *MockSession
func (*MockSession) WithChannel ¶
func (ms *MockSession) WithChannel(ch *discordgo.Channel) *MockSession
func (*MockSession) WithGuild ¶
func (ms *MockSession) WithGuild(guild *discordgo.Guild) *MockSession
func (*MockSession) WithMember ¶
func (ms *MockSession) WithMember(guildID string, member *discordgo.Member) *MockSession
type MongoContainer ¶
type MongoContainer struct {
// contains filtered or unexported fields
}
MongoContainer wraps a running MongoDB testcontainers instance and the connection URI needed to build *store.Store instances.
func StartMongoDB ¶
func StartMongoDB(t TBF) *MongoContainer
StartMongoDB starts a MongoDB container using testcontainers-go. The container is terminated when Cleanup is called. This is intended to be called once per test suite, typically in a Ginkgo BeforeSuite block.
func (*MongoContainer) Cleanup ¶
func (m *MongoContainer) Cleanup()
Cleanup terminates the MongoDB container. Call this via DeferCleanup in a Ginkgo AfterSuite.
func (*MongoContainer) NewTestStore ¶
func (m *MongoContainer) NewTestStore(t TBF) *store.Store
NewTestStore creates a *store.Store connected to the given MongoDB container. Each call creates a uniquely-named database (test_eugen_<n>) to provide isolation between tests within the same suite.