From ff709fc16ca0c6d2133063a3c66c85d53cf7014e Mon Sep 17 00:00:00 2001 From: diamondburned Date: Fri, 3 Nov 2023 19:35:40 -0700 Subject: [PATCH] bot: Fix failing ./extras/middlewares test --- .../extras/middlewares/middlewares_test.go | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/utils/bot/extras/middlewares/middlewares_test.go b/utils/bot/extras/middlewares/middlewares_test.go index fc4f8d3..daacf1c 100644 --- a/utils/bot/extras/middlewares/middlewares_test.go +++ b/utils/bot/extras/middlewares/middlewares_test.go @@ -168,6 +168,7 @@ type mockStore struct { func mockCabinet() *store.Cabinet { c := *store.NoopCabinet + c.RoleStore = &mockStore{} c.GuildStore = &mockStore{} c.MemberStore = &mockStore{} c.ChannelStore = &mockStore{} @@ -178,13 +179,28 @@ func mockCabinet() *store.Cabinet { func (s *mockStore) Guild(id discord.GuildID) (*discord.Guild, error) { return &discord.Guild{ ID: id, - Roles: []discord.Role{{ + }, nil +} + +func (s *mockStore) Roles(id discord.GuildID) ([]discord.Role, error) { + return []discord.Role{ + { ID: 69420, Permissions: discord.PermissionAdministrator, - }}, + }, }, nil } +func (s *mockStore) Role(_ discord.GuildID, roleID discord.RoleID) (*discord.Role, error) { + if roleID == 69420 { + return &discord.Role{ + ID: roleID, + Permissions: discord.PermissionAdministrator, + }, nil + } + return nil, store.ErrNotFound +} + func (s *mockStore) Member(_ discord.GuildID, userID discord.UserID) (*discord.Member, error) { return &discord.Member{ User: discord.User{ID: userID},