fix(events): only trigger task.updated once when marking task done

Resolves https://github.com/go-vikunja/vikunja/issues/1724
This commit is contained in:
kolaente
2025-11-16 11:01:15 +01:00
parent f96601bf18
commit 9b78584734
5 changed files with 95 additions and 38 deletions

View File

@@ -61,3 +61,20 @@ func TestListener(t *testing.T, event Event, listener Listener) {
err = listener.Handle(msg)
require.NoError(t, err)
}
// ClearDispatchedEvents clears the list of dispatched test events. This is useful when you want to
// test event dispatch counts in a specific section of code without events from previous test operations.
func ClearDispatchedEvents() {
dispatchedTestEvents = nil
}
// CountDispatchedEvents counts how many events of a specific type have been dispatched.
func CountDispatchedEvents(eventName string) int {
count := 0
for _, testEvent := range dispatchedTestEvents {
if testEvent.Name() == eventName {
count++
}
}
return count
}