createOne(); Event::assertDispatched(ExternalProfileCreated::class); }); test('external profile deleted event dispatched', function () { $profile = ExternalProfile::factory()->createOne(); $profile->delete(); Event::assertDispatched(ExternalProfileDeleted::class); }); test('external profile updated event dispatched', function () { $profile = ExternalProfile::factory()->createOne(); $changes = ExternalProfile::factory()->makeOne(); $profile->fill($changes->getAttributes()); $profile->save(); Event::assertDispatched(ExternalProfileUpdated::class); }); test('external profile updated event embed fields', function () { $profile = ExternalProfile::factory()->createOne(); $changes = ExternalProfile::factory()->makeOne(); $profile->fill($changes->getAttributes()); $profile->save(); Event::assertDispatched(ExternalProfileUpdated::class, function (ExternalProfileUpdated $event) { $message = $event->getDiscordMessage(); return ! empty(Arr::get($message->embed, 'fields')); }); });