feat: domain blocker plugin
Some checks failed
ci/woodpecker/tag/release Pipeline was successful
ci/woodpecker/push/ci Pipeline failed

This commit is contained in:
Felipe M 2025-04-22 18:09:27 +02:00
parent c9edb57505
commit 7dd02c0056
Signed by: fmartingr
GPG key ID: CCFBC5637D4000A8
25 changed files with 898 additions and 63 deletions

View file

@ -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 {