<?php

namespace Tests\Unit;

use App\Modules\Sales\Services\CodeWeavers;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Mtc\MercuryDataModels\Vehicle;
use Mtc\MercuryDataModels\VehicleFinance;
use Tests\TenantTestCase;
use Tests\TestCase;

class CodeWeaversEcommerceTest extends TenantTestCase
{

    /**
     * A basic feature test example.
     *
     * @return void
     */
    public function testGetEcommerceData()
    {
        $vehicle = Vehicle::factory()->create(['monthly_price' => 123]);
        VehicleFinance::factory()->create([
            'vehicle_id' => $vehicle->id,
            'provider' => 'codeweavers',
            'monthly_price' => 123,
            'apply_url' => 'http://foo.baz/bar'
        ]);

        $response = (new CodeWeavers())->ecommerceData($vehicle);
        $this->assertEquals('http://foo.baz/bar', $response['url']);
    }
}
