createOne(); Event::assertDispatched(SongCreated::class); }); test('song deleted event dispatched', function (): void { $song = Song::factory()->createOne(); $song->delete(); Event::assertDispatched(SongDeleted::class); }); test('song restored event dispatched', function (): void { $song = Song::factory()->createOne(); $song->restore(); Event::assertDispatched(SongRestored::class); }); test('song restores quietly', function (): void { $song = Song::factory()->createOne(); $song->restore(); Event::assertNotDispatched(SongUpdated::class); }); test('song updated event dispatched', function (): void { $song = Song::factory()->createOne(); $changes = Song::factory()->makeOne(); $song->fill($changes->getAttributes()); $song->save(); Event::assertDispatched(SongUpdated::class); }); test('song updated event embed fields', function (): void { $song = Song::factory()->createOne(); $changes = Song::factory()->makeOne(); $song->fill($changes->getAttributes()); $song->save(); Event::assertDispatched(SongUpdated::class, function (SongUpdated $event): bool { $message = $event->getDiscordMessage(); return filled(Arr::get($message->embed, 'fields')); }); });