<?php

namespace Tests\Feature\Imports;

use App\Models\JobSource;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class DefaultJobSourcesTest extends TestCase
{
    use RefreshDatabase;

    public function test_default_remote_job_sources_are_available_in_admin_module(): void
    {
        foreach ([
            'manual-curation',
            'weworkremotely',
            'jobicy-rss',
            'remotive-api',
            'jobicy-api',
            'arbeitnow-api',
        ] as $slug) {
            $this->assertDatabaseHas('job_sources', [
                'slug' => $slug,
            ]);
        }

        $this->assertSame('rss', JobSource::query()->where('slug', 'weworkremotely')->value('type'));
        $this->assertSame('json', JobSource::query()->where('slug', 'remotive-api')->value('type'));
        $this->assertFalse((bool) JobSource::query()->where('slug', 'jobicy-rss')->value('is_active'));
        $this->assertTrue((bool) JobSource::query()->where('slug', 'jobicy-api')->value('is_active'));
    }
}
