mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-26 17:43:21 +01:00
refactor(test): consolidate two GuildRepo mocks into one
mockGuildRepoForMail and mockGuildRepoOps each implemented different subsets of the 68-method GuildRepo interface. Adding any new method required updating both mocks. Merged into a single mockGuildRepo with configurable struct fields for error injection and no-op defaults for the rest.
This commit is contained in:
@@ -101,7 +101,7 @@ func TestMailService_SendGuildInvite(t *testing.T) {
|
||||
|
||||
func TestMailService_BroadcastToGuild(t *testing.T) {
|
||||
mailMock := &mockMailRepo{}
|
||||
guildMock := &mockGuildRepoForMail{
|
||||
guildMock := &mockGuildRepo{
|
||||
members: []*GuildMember{
|
||||
{CharID: 100},
|
||||
{CharID: 200},
|
||||
@@ -132,7 +132,7 @@ func TestMailService_BroadcastToGuild(t *testing.T) {
|
||||
|
||||
func TestMailService_BroadcastToGuild_GetMembersError(t *testing.T) {
|
||||
mailMock := &mockMailRepo{}
|
||||
guildMock := &mockGuildRepoForMail{getMembersErr: errors.New("db fail")}
|
||||
guildMock := &mockGuildRepo{getMembersErr: errors.New("db fail")}
|
||||
logger, _ := zap.NewDevelopment()
|
||||
svc := NewMailService(mailMock, guildMock, logger)
|
||||
|
||||
@@ -147,7 +147,7 @@ func TestMailService_BroadcastToGuild_GetMembersError(t *testing.T) {
|
||||
|
||||
func TestMailService_BroadcastToGuild_SendError(t *testing.T) {
|
||||
mailMock := &mockMailRepo{sendErr: errors.New("db fail")}
|
||||
guildMock := &mockGuildRepoForMail{
|
||||
guildMock := &mockGuildRepo{
|
||||
members: []*GuildMember{
|
||||
{CharID: 100},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user