Merge pull request #129 from velour/nerdepeida

Add pokemon. Extra dune trigger. Actually have a test for each endpoint
This commit is contained in:
Scott Kiesel 2019-01-19 11:09:02 -05:00 committed by GitHub
commit 0d730ee08a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"
} 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 != "" {

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()
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)
}