<?php

namespace Tests\Unit;

use App\Models\User;
use App\Services\Bot\ConversationStateStore;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class ConversationStateStoreTest extends TestCase
{
    use RefreshDatabase;

    public function test_state_is_saved_in_cache(): void
    {
        $user = User::factory()->create();
        $store = app(ConversationStateStore::class);

        $store->set($user, 'awaiting_unit_selection');
        $this->assertSame('awaiting_unit_selection', $store->get($user));

        $store->set($user, null);
        $this->assertNull($store->get($user));
    }
}
