<?php

namespace Tests\Unit\Listeners;

use App\Events\DeleteUnverifiedUser;
use App\Listeners\DeleteUnverifiedUserListener;
use App\Services\Users\DeleteUnverifiedUserService;
use Mockery;
use Tests\TestCase;

class DeleteUnverifiedUserListenerTest extends TestCase
{
    public function test_listener_invokes_service(): void
    {
        $service = Mockery::mock(DeleteUnverifiedUserService::class);
        $service->shouldReceive('deleteAfterTimeout')->once()->with(15)->andReturn(['ok' => true]);

        $listener = new DeleteUnverifiedUserListener($service);
        $listener->handle(new DeleteUnverifiedUser(15));

        $this->assertTrue(true);
    }
}
