test: update event assertions to work with deferred dispatch
Tests that call model methods directly now call events.DispatchPending before asserting event dispatch. Refs #2315
This commit is contained in:
parent
6ed684d708
commit
f516bbe560
|
|
@ -45,6 +45,7 @@ func TestTaskComment_Create(t *testing.T) {
|
|||
assert.Equal(t, int64(1), tc.Author.ID)
|
||||
err = s.Commit()
|
||||
require.NoError(t, err)
|
||||
events.DispatchPending(s)
|
||||
events.AssertDispatched(t, &TaskCommentCreatedEvent{})
|
||||
|
||||
db.AssertExists(t, "task_comments", map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ func TestTask_Create(t *testing.T) {
|
|||
"bucket_id": 1,
|
||||
}, false)
|
||||
|
||||
events.DispatchPending(s)
|
||||
events.AssertDispatched(t, &TaskCreatedEvent{})
|
||||
})
|
||||
t.Run("with reminders", func(t *testing.T) {
|
||||
|
|
@ -279,6 +280,7 @@ func TestTask_Update(t *testing.T) {
|
|||
err = s.Commit()
|
||||
require.NoError(t, err)
|
||||
|
||||
events.DispatchPending(s)
|
||||
// Verify exactly ONE task.updated event was dispatched
|
||||
count := events.CountDispatchedEvents("task.updated")
|
||||
assert.Equal(t, 1, count, "Expected exactly 1 task.updated event, got %d", count)
|
||||
|
|
|
|||
Loading…
Reference in New Issue