<?php

namespace Tests\Feature;

use App\Http\Resources\UiResponsiveProductList;
use Mtc\MercuryDataModels\Vehicle;
use Tests\DatabaseTestCase;

class ResponsiveProductListTest extends DatabaseTestCase
{
    public function testUiResponsiveProductList()
    {
        Vehicle::factory(5)->create(['is_published' => true, 'featured' => 1]);
        $resource = (new UiResponsiveProductList((object)['name' => 'foo baz bar']))->toArray(request());
        $this->assertEquals('foo baz bar', $resource['name']);
        $this->assertArrayHasKey('items', $resource);
        $this->assertCount(4, $resource['items']);
    }
}
