<?php

namespace Tests\Feature;

use Carbon\Carbon;
use Mtc\MercuryDataModels\Dealership;
use Tests\DatabaseTestCase;

class MiddlewareTest extends DatabaseTestCase
{
    public function testSuspended()
    {
        Dealership::factory(3)->create();
        $response = $this->asTenant(tenant())->getJson(route('dealerships.index'));
        $response->assertStatus(200);

        tenant()->update([
            'suspended_at' => Carbon::now()
        ]);

        $response = $this->asTenant(tenant())->getJson(route('dealerships.index'));
        $response->assertStatus(423);
    }
}
