feat: domain blocker plugin
This commit is contained in:
parent
c9edb57505
commit
7dd02c0056
25 changed files with 898 additions and 63 deletions
|
@ -142,14 +142,25 @@ func TestReminderOnMessage(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
initialCount := len(creator.reminders)
|
||||
responses := plugin.OnMessage(tt.message, nil)
|
||||
actions := plugin.OnMessage(tt.message, nil)
|
||||
|
||||
if tt.expectResponse && len(responses) == 0 {
|
||||
t.Errorf("Expected response, but got none")
|
||||
if tt.expectResponse && len(actions) == 0 {
|
||||
t.Errorf("Expected response action, but got none")
|
||||
}
|
||||
|
||||
if !tt.expectResponse && len(responses) > 0 {
|
||||
t.Errorf("Expected no response, but got %d", len(responses))
|
||||
if !tt.expectResponse && len(actions) > 0 {
|
||||
t.Errorf("Expected no actions, but got %d", len(actions))
|
||||
}
|
||||
|
||||
// Verify action type is correct when actions are returned
|
||||
if len(actions) > 0 {
|
||||
if actions[0].Type != model.ActionSendMessage {
|
||||
t.Errorf("Expected action type to be %s, but got %s", model.ActionSendMessage, actions[0].Type)
|
||||
}
|
||||
|
||||
if actions[0].Message == nil {
|
||||
t.Errorf("Expected message in action to not be nil")
|
||||
}
|
||||
}
|
||||
|
||||
if tt.expectReminder && len(creator.reminders) != initialCount+1 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue