From b33eccaaa0edd05942b226e23681f69e117fad0a Mon Sep 17 00:00:00 2001 From: skkiesel Date: Sat, 19 Jan 2019 11:06:13 -0500 Subject: [PATCH] Add pokemon. Extra dune trigger. Actually have a test for each endpoint --- plugins/nerdepedia/nerdepedia.go | 4 +++- plugins/nerdepedia/nerdepeida_test.go | 29 ++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/plugins/nerdepedia/nerdepedia.go b/plugins/nerdepedia/nerdepedia.go index aa2665a..1da2514 100644 --- a/plugins/nerdepedia/nerdepedia.go +++ b/plugins/nerdepedia/nerdepedia.go @@ -44,10 +44,12 @@ func (p *NerdepediaPlugin) Message(message msg.Message) bool { query = "http://starwars.wikia.com/wiki/Special:Random" } else if lowerCase == "beam me up scotty" || lowerCase == "live long and prosper" { query = "http://memory-alpha.wikia.com/wiki/Special:Random" - } else if lowerCase == "bless the maker" || lowerCase == "i must not fear" { + } else if lowerCase == "bless the maker" || lowerCase == "i must not fear" || lowerCase == "the spice must flow" { query = "http://dune.wikia.com/wiki/Special:Random" } else if lowerCase == "my precious" || lowerCase == "one ring to rule them all" || lowerCase == "one does not simply walk into mordor" { query = "http://lotr.wikia.com/wiki/Special:Random" + } else if lowerCase == "pikachu i choose you" || lowerCase == "gotta catch em all" { + query = "http://pokemon.wikia.com/wiki/Special:Random" } if query != "" { diff --git a/plugins/nerdepedia/nerdepeida_test.go b/plugins/nerdepedia/nerdepeida_test.go index 04d3ad0..5cba343 100644 --- a/plugins/nerdepedia/nerdepeida_test.go +++ b/plugins/nerdepedia/nerdepeida_test.go @@ -25,7 +25,7 @@ func makeMessage(payload string) msg.Message { } } -func TestObiWan(t *testing.T) { +func TestWars(t *testing.T) { mb := bot.NewMockBot() c := New(mb) assert.NotNil(t, c) @@ -33,3 +33,30 @@ func TestObiWan(t *testing.T) { assert.Len(t, mb.Messages, 1) assert.True(t, res) } + +func TestTrek(t *testing.T) { + mb := bot.NewMockBot() + c := New(mb) + assert.NotNil(t, c) + res := c.Message(makeMessage("live long and prosper")) + assert.Len(t, mb.Messages, 1) + assert.True(t, res) +} + +func TestDune(t *testing.T) { + mb := bot.NewMockBot() + c := New(mb) + assert.NotNil(t, c) + res := c.Message(makeMessage("bless the maker")) + assert.Len(t, mb.Messages, 1) + assert.True(t, res) +} + +func TestPoke(t *testing.T) { + mb := bot.NewMockBot() + c := New(mb) + assert.NotNil(t, c) + res := c.Message(makeMessage("gotta catch em all")) + assert.Len(t, mb.Messages, 1) + assert.True(t, res) +}