From b20da607bcd4c1733b8dd1b1f94ce1659b6fe457 Mon Sep 17 00:00:00 2001 From: Chris Sexton <3216719+chrissexton@users.noreply.github.com> Date: Tue, 27 Feb 2024 17:28:02 -0500 Subject: [PATCH] cli: finish removing references from tests --- plugins/admin/admin_test.go | 4 ---- plugins/babbler/babbler_test.go | 7 +------ plugins/beers/beers_test.go | 6 +----- plugins/couldashouldawoulda/csw_test.go | 3 --- plugins/counter/counter_test.go | 8 ++++---- plugins/dice/dice_test.go | 5 +---- plugins/leftpad/leftpad_test.go | 3 --- plugins/nerdepedia/nerdepeida_test.go | 3 --- plugins/picker/picker_test.go | 2 -- plugins/remember/remember_test.go | 3 --- plugins/reminder/reminder_test.go | 5 ++--- plugins/rss/rss_test.go | 3 +-- plugins/stock/stock_test.go | 3 +-- plugins/talker/talker_test.go | 5 ++--- plugins/tldr/tldr_test.go | 2 -- plugins/twitch/twitch_test.go | 3 +-- plugins/your/your_test.go | 3 --- 17 files changed, 14 insertions(+), 54 deletions(-) diff --git a/plugins/admin/admin_test.go b/plugins/admin/admin_test.go index ba0d859..8c536f7 100644 --- a/plugins/admin/admin_test.go +++ b/plugins/admin/admin_test.go @@ -5,8 +5,6 @@ import ( "strings" "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" @@ -34,10 +32,8 @@ func makeMessage(payload string, r *regexp.Regexp) bot.Request { if isCmd { payload = payload[1:] } - c := cli.CliPlugin{} values := bot.ParseValues(r, payload) return bot.Request{ - Conn: &c, Kind: bot.Message, Values: values, Msg: msg.Message{ diff --git a/plugins/babbler/babbler_test.go b/plugins/babbler/babbler_test.go index fc25233..8b80d62 100644 --- a/plugins/babbler/babbler_test.go +++ b/plugins/babbler/babbler_test.go @@ -7,8 +7,6 @@ import ( "strings" "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" @@ -16,13 +14,11 @@ import ( ) func makeMessage(payload string, r *regexp.Regexp) bot.Request { - c := &cli.CliPlugin{} isCmd := strings.HasPrefix(payload, "!") if isCmd { payload = payload[1:] } return bot.Request{ - Conn: c, Kind: bot.Message, Values: bot.ParseValues(r, payload), Msg: msg.Message{ @@ -272,7 +268,6 @@ func TestHelp(t *testing.T) { mb := bot.NewMockBot() bp := newBabblerPlugin(mb) assert.NotNil(t, bp) - c := &cli.CliPlugin{} - bp.help(c, bot.Help, msg.Message{Channel: "channel"}, []string{}) + bp.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{}) assert.Len(t, mb.Messages, 1) } diff --git a/plugins/beers/beers_test.go b/plugins/beers/beers_test.go index 68e2dee..96a770e 100644 --- a/plugins/beers/beers_test.go +++ b/plugins/beers/beers_test.go @@ -7,8 +7,6 @@ import ( "strings" "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" @@ -21,10 +19,8 @@ func makeMessage(payload string, r *regexp.Regexp) bot.Request { if isCmd { payload = payload[1:] } - c := &cli.CliPlugin{} values := bot.ParseValues(r, payload) return bot.Request{ - Conn: c, Kind: bot.Message, Values: values, Msg: msg.Message{ @@ -136,6 +132,6 @@ func TestBeersReport(t *testing.T) { func TestHelp(t *testing.T) { b, mb := makeBeersPlugin(t) - b.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{}) + b.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{}) assert.Len(t, mb.Messages, 1) } diff --git a/plugins/couldashouldawoulda/csw_test.go b/plugins/couldashouldawoulda/csw_test.go index 6a75f46..05d044e 100644 --- a/plugins/couldashouldawoulda/csw_test.go +++ b/plugins/couldashouldawoulda/csw_test.go @@ -6,8 +6,6 @@ import ( "strings" "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" @@ -21,7 +19,6 @@ func makeMessage(payload string) bot.Request { payload = payload[1:] } return bot.Request{ - Conn: &cli.CliPlugin{}, Kind: bot.Message, Msg: msg.Message{ User: &user.User{Name: "tester"}, diff --git a/plugins/counter/counter_test.go b/plugins/counter/counter_test.go index f30998b..bfb1873 100644 --- a/plugins/counter/counter_test.go +++ b/plugins/counter/counter_test.go @@ -4,12 +4,12 @@ package counter import ( "fmt" + "github.com/velour/catbase/config" + "github.com/velour/catbase/connectors/irc" "regexp" "strings" "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" @@ -33,7 +33,7 @@ func makeMessage(payload string, r *regexp.Regexp) bot.Request { } values := bot.ParseValues(r, payload) return bot.Request{ - Conn: &cli.CliPlugin{}, + Conn: irc.New(&config.Config{}), Msg: msg.Message{ User: &user.User{Name: "tester", ID: "id"}, Body: payload, @@ -280,6 +280,6 @@ func TestInspectMe(t *testing.T) { func TestHelp(t *testing.T) { mb, c := setup(t) assert.NotNil(t, c) - c.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{}) + c.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{}) assert.Greater(t, len(mb.Messages), 1) } diff --git a/plugins/dice/dice_test.go b/plugins/dice/dice_test.go index 42af4f9..dedcc52 100644 --- a/plugins/dice/dice_test.go +++ b/plugins/dice/dice_test.go @@ -6,8 +6,6 @@ import ( "strings" "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" @@ -21,7 +19,6 @@ func makeMessage(payload string) bot.Request { } values := bot.ParseValues(rollRegex, payload) return bot.Request{ - Conn: &cli.CliPlugin{}, Kind: bot.Message, Values: values, Msg: msg.Message{ @@ -67,6 +64,6 @@ func TestHelp(t *testing.T) { mb := bot.NewMockBot() c := New(mb) assert.NotNil(t, c) - c.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{}) + c.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{}) assert.Len(t, mb.Messages, 1) } diff --git a/plugins/leftpad/leftpad_test.go b/plugins/leftpad/leftpad_test.go index a1e18db..09bfdb3 100644 --- a/plugins/leftpad/leftpad_test.go +++ b/plugins/leftpad/leftpad_test.go @@ -5,8 +5,6 @@ package leftpad import ( "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" @@ -18,7 +16,6 @@ func makeMessage(payload string) bot.Request { values := bot.ParseValues(leftpadRegex, payload) return bot.Request{ Kind: bot.Message, - Conn: &cli.CliPlugin{}, Values: values, Msg: msg.Message{ User: &user.User{Name: "tester"}, diff --git a/plugins/nerdepedia/nerdepeida_test.go b/plugins/nerdepedia/nerdepeida_test.go index 05ce338..11af8f6 100644 --- a/plugins/nerdepedia/nerdepeida_test.go +++ b/plugins/nerdepedia/nerdepeida_test.go @@ -12,8 +12,6 @@ import ( "github.com/rs/zerolog/log" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" @@ -45,7 +43,6 @@ func makeMessage(payload string) bot.Request { payload = payload[1:] } return bot.Request{ - Conn: &cli.CliPlugin{}, Kind: bot.Message, Msg: msg.Message{ User: &user.User{Name: "tester"}, diff --git a/plugins/picker/picker_test.go b/plugins/picker/picker_test.go index e785e9b..3311d73 100644 --- a/plugins/picker/picker_test.go +++ b/plugins/picker/picker_test.go @@ -12,7 +12,6 @@ import ( "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" "github.com/velour/catbase/bot/user" - "github.com/velour/catbase/plugins/cli" ) func makeMessage(payload string) bot.Request { @@ -22,7 +21,6 @@ func makeMessage(payload string) bot.Request { } values := bot.ParseValues(pickRegex, payload) return bot.Request{ - Conn: &cli.CliPlugin{}, Kind: bot.Message, Values: values, Msg: msg.Message{ diff --git a/plugins/remember/remember_test.go b/plugins/remember/remember_test.go index 5f16a9c..a152760 100644 --- a/plugins/remember/remember_test.go +++ b/plugins/remember/remember_test.go @@ -5,8 +5,6 @@ import ( "strings" "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" @@ -20,7 +18,6 @@ func makeMessage(nick, payload string, r *regexp.Regexp) bot.Request { payload = payload[1:] } return bot.Request{ - Conn: &cli.CliPlugin{}, Kind: bot.Message, Values: bot.ParseValues(r, payload), Msg: msg.Message{ diff --git a/plugins/reminder/reminder_test.go b/plugins/reminder/reminder_test.go index 04a4622..e4a626a 100644 --- a/plugins/reminder/reminder_test.go +++ b/plugins/reminder/reminder_test.go @@ -4,7 +4,6 @@ package reminder import ( "fmt" - "github.com/velour/catbase/plugins/cli" "strings" "testing" "time" @@ -24,7 +23,7 @@ func makeMessageBy(payload, by string) (bot.Connector, bot.Kind, msg.Message) { if isCmd { payload = payload[1:] } - return &cli.CliPlugin{}, bot.Message, msg.Message{ + return nil, bot.Message, msg.Message{ User: &user.User{Name: by}, Channel: "test", Body: payload, @@ -224,6 +223,6 @@ func TestLimitList(t *testing.T) { func TestHelp(t *testing.T) { c, mb := setup(t) assert.NotNil(t, c) - c.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{}) + c.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{}) assert.Len(t, mb.Messages, 1) } diff --git a/plugins/rss/rss_test.go b/plugins/rss/rss_test.go index 110fdf2..9d62be4 100644 --- a/plugins/rss/rss_test.go +++ b/plugins/rss/rss_test.go @@ -2,7 +2,6 @@ package rss import ( "fmt" - "github.com/velour/catbase/plugins/cli" "strings" "testing" @@ -17,7 +16,7 @@ func makeMessage(payload string) (bot.Connector, bot.Kind, msg.Message) { if isCmd { payload = payload[1:] } - return &cli.CliPlugin{}, bot.Message, msg.Message{ + return nil, bot.Message, msg.Message{ User: &user.User{Name: "tester"}, Channel: "test", Body: payload, diff --git a/plugins/stock/stock_test.go b/plugins/stock/stock_test.go index 914f6d2..3aabe59 100644 --- a/plugins/stock/stock_test.go +++ b/plugins/stock/stock_test.go @@ -1,7 +1,6 @@ package stock import ( - "github.com/velour/catbase/plugins/cli" "strings" "testing" @@ -16,7 +15,7 @@ func makeMessage(payload string) (bot.Connector, bot.Kind, msg.Message) { if isCmd { payload = payload[1:] } - return &cli.CliPlugin{}, bot.Message, msg.Message{ + return nil, bot.Message, msg.Message{ User: &user.User{Name: "tester"}, Channel: "test", Body: payload, diff --git a/plugins/talker/talker_test.go b/plugins/talker/talker_test.go index cf3defe..fbea7d5 100644 --- a/plugins/talker/talker_test.go +++ b/plugins/talker/talker_test.go @@ -3,7 +3,6 @@ package talker import ( - "github.com/velour/catbase/plugins/cli" "strings" "testing" @@ -18,7 +17,7 @@ func makeMessage(payload string) (bot.Connector, bot.Kind, msg.Message) { if isCmd { payload = payload[1:] } - return &cli.CliPlugin{}, bot.Message, msg.Message{ + return nil, bot.Message, msg.Message{ User: &user.User{Name: "tester"}, Channel: "test", Body: payload, @@ -79,6 +78,6 @@ func TestHelp(t *testing.T) { mb := bot.NewMockBot() c := New(mb) assert.NotNil(t, c) - c.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{}) + c.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{}) assert.Len(t, mb.Messages, 1) } diff --git a/plugins/tldr/tldr_test.go b/plugins/tldr/tldr_test.go index fd9fa41..5456ac5 100644 --- a/plugins/tldr/tldr_test.go +++ b/plugins/tldr/tldr_test.go @@ -1,7 +1,6 @@ package tldr import ( - "github.com/velour/catbase/plugins/cli" "os" "strconv" "strings" @@ -29,7 +28,6 @@ func makeMessageBy(payload, by string) bot.Request { } return bot.Request{ - Conn: &cli.CliPlugin{}, Kind: bot.Message, Msg: msg.Message{ User: &user.User{Name: by}, diff --git a/plugins/twitch/twitch_test.go b/plugins/twitch/twitch_test.go index 3a7efdd..d36978a 100644 --- a/plugins/twitch/twitch_test.go +++ b/plugins/twitch/twitch_test.go @@ -3,7 +3,6 @@ package twitch import ( - "github.com/velour/catbase/plugins/cli" "strings" "testing" @@ -29,7 +28,7 @@ func makeMessage(payload string) (bot.Connector, bot.Kind, msg.Message) { if isCmd { payload = payload[1:] } - return &cli.CliPlugin{}, bot.Message, msg.Message{ + return nil, bot.Message, msg.Message{ User: &user.User{Name: "tester"}, Channel: "test", Body: payload, diff --git a/plugins/your/your_test.go b/plugins/your/your_test.go index 93d47b8..ea9ee78 100644 --- a/plugins/your/your_test.go +++ b/plugins/your/your_test.go @@ -6,8 +6,6 @@ import ( "strings" "testing" - "github.com/velour/catbase/plugins/cli" - "github.com/stretchr/testify/assert" "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" @@ -20,7 +18,6 @@ func makeMessage(payload string) bot.Request { payload = payload[1:] } return bot.Request{ - Conn: &cli.CliPlugin{}, Kind: bot.Message, Msg: msg.Message{ User: &user.User{Name: "tester"},