createOne(); Event::assertDispatched(VideoCreated::class); }); test('video deleted event dispatched', function (): void { $video = Video::factory()->createOne(); $video->delete(); Event::assertDispatched(VideoDeleted::class); }); test('video restored event dispatched', function (): void { $video = Video::factory()->createOne(); $video->restore(); Event::assertDispatched(VideoRestored::class); }); test('video restores quietly', function (): void { $video = Video::factory()->createOne(); $video->restore(); Event::assertNotDispatched(VideoUpdated::class); }); test('video updated event dispatched', function (): void { $video = Video::factory()->createOne(); $changes = Video::factory()->makeOne(); $video->fill($changes->getAttributes()); $video->save(); Event::assertDispatched(VideoUpdated::class); }); test('video updated event embed fields', function (): void { $video = Video::factory()->createOne(); $changes = Video::factory()->makeOne(); $video->fill($changes->getAttributes()); $video->save(); Event::assertDispatched(VideoUpdated::class, function (VideoUpdated $event): bool { $message = $event->getDiscordMessage(); return filled(Arr::get($message->embed, 'fields')); }); });