Add pokemon. Extra dune trigger. Actually have a test for each endpoint

This commit is contained in:
skkiesel 2019-01-19 11:06:13 -05:00
parent 13c6897a0a
commit b33eccaaa0
2 changed files with 31 additions and 2 deletions

View File

@ -44,10 +44,12 @@ func (p *NerdepediaPlugin) Message(message msg.Message) bool {
query = "http://starwars.wikia.com/wiki/Special:Random" query = "http://starwars.wikia.com/wiki/Special:Random"
} else if lowerCase == "beam me up scotty" || lowerCase == "live long and prosper" { } else if lowerCase == "beam me up scotty" || lowerCase == "live long and prosper" {
query = "http://memory-alpha.wikia.com/wiki/Special:Random" 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" 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" { } 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" 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 != "" { if query != "" {

View File

@ -25,7 +25,7 @@ func makeMessage(payload string) msg.Message {
} }
} }
func TestObiWan(t *testing.T) { func TestWars(t *testing.T) {
mb := bot.NewMockBot() mb := bot.NewMockBot()
c := New(mb) c := New(mb)
assert.NotNil(t, c) assert.NotNil(t, c)
@ -33,3 +33,30 @@ func TestObiWan(t *testing.T) {
assert.Len(t, mb.Messages, 1) assert.Len(t, mb.Messages, 1)
assert.True(t, res) 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)
}