mirror of https://github.com/velour/catbase.git
reminder: change the confirmation of remind me
This commit is contained in:
parent
03f979bde4
commit
2ffbc6fb93
|
@ -31,6 +31,7 @@ func makeBeersPlugin(t *testing.T) (*BeersPlugin, *bot.MockBot) {
|
||||||
counter.New(mb)
|
counter.New(mb)
|
||||||
b := New(mb)
|
b := New(mb)
|
||||||
assert.NotNil(t, b)
|
assert.NotNil(t, b)
|
||||||
|
b.Message(makeMessage("!mkalias beer :beer:"))
|
||||||
return b, mb
|
return b, mb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,9 +146,10 @@ func (p *ReminderPlugin) Message(message msg.Message) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if doConfirm {
|
if doConfirm && from == who {
|
||||||
response := fmt.Sprintf("Sure %s, I'll remind %s.", from, who)
|
p.Bot.SendMessage(channel, fmt.Sprintf("Okay. I'll remind you."))
|
||||||
p.Bot.SendMessage(channel, response)
|
} else if doConfirm {
|
||||||
|
p.Bot.SendMessage(channel, fmt.Sprintf("Sure %s, I'll remind %s.", from, who))
|
||||||
}
|
}
|
||||||
|
|
||||||
p.queueUpNextReminder()
|
p.queueUpNextReminder()
|
||||||
|
|
|
@ -40,6 +40,18 @@ func makeMessageBy(payload, by string) msg.Message {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMeReminder(t *testing.T) {
|
||||||
|
mb := bot.NewMockBot()
|
||||||
|
c := New(mb)
|
||||||
|
assert.NotNil(t, c)
|
||||||
|
res := c.Message(makeMessage("!remind me in 1s don't fail this test"))
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
|
assert.Len(t, mb.Messages, 2)
|
||||||
|
assert.True(t, res)
|
||||||
|
assert.Contains(t, mb.Messages[0], "Okay. I'll remind you.")
|
||||||
|
assert.Contains(t, mb.Messages[1], "Hey tester, you wanted you to be reminded: don't fail this test")
|
||||||
|
}
|
||||||
|
|
||||||
func TestReminder(t *testing.T) {
|
func TestReminder(t *testing.T) {
|
||||||
mb := bot.NewMockBot()
|
mb := bot.NewMockBot()
|
||||||
c := New(mb)
|
c := New(mb)
|
||||||
|
|
Loading…
Reference in New Issue