<?php

namespace Tests\Feature\Seeders;

use App\Domains\Tenant\Models\SocialMedia;
use Database\Seeders\SocialMediaSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class SocialMediaSeederTest extends TestCase
{
    use RefreshDatabase;

    public function test_it_seeds_the_supported_social_media_with_font_awesome_icons(): void
    {
        $this->seed(SocialMediaSeeder::class);

        $this->assertSame([
            [
                'code' => 'facebook',
                'icon' => 'fa-brands fa-facebook',
                'name' => 'Facebook',
            ],
            [
                'code' => 'instagram',
                'icon' => 'fa-brands fa-instagram',
                'name' => 'Instagram',
            ],
            [
                'code' => 'linkedin',
                'icon' => 'fa-brands fa-linkedin-in',
                'name' => 'LinkedIn',
            ],
            [
                'code' => 'whatsapp',
                'icon' => 'fa-brands fa-whatsapp',
                'name' => 'WhatsApp',
            ],
        ], SocialMedia::query()
            ->orderBy('code')
            ->get(['code', 'icon', 'name'])
            ->toArray());
    }

    public function test_it_can_run_more_than_once_without_creating_duplicates(): void
    {
        $this->seed(SocialMediaSeeder::class);
        $this->seed(SocialMediaSeeder::class);

        $this->assertSame(4, SocialMedia::query()->count());
    }
}
