createOne(); Event::assertDispatched(GroupCreated::class); }); test('group deleted event dispatched', function () { $group = Group::factory()->createOne(); $group->delete(); Event::assertDispatched(GroupDeleted::class); }); test('group restored event dispatched', function () { $group = Group::factory()->createOne(); $group->restore(); Event::assertDispatched(GroupRestored::class); }); test('group restores quietly', function () { $group = Group::factory()->createOne(); $group->restore(); Event::assertNotDispatched(GroupUpdated::class); }); test('group updated event dispatched', function () { $group = Group::factory()->createOne(); $changes = Group::factory()->makeOne(); $group->fill($changes->getAttributes()); $group->save(); Event::assertDispatched(GroupUpdated::class); }); test('group updated event embed fields', function () { $group = Group::factory()->createOne(); $changes = Group::factory()->makeOne(); $group->fill($changes->getAttributes()); $group->save(); Event::assertDispatched(GroupUpdated::class, function (GroupUpdated $event) { $message = $event->getDiscordMessage(); return ! empty(Arr::get($message->embed, 'fields')); }); });