<?php

namespace Tests\Feature;

use App\Models\User;
use App\Models\Website;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class DashboardTokensTest extends TestCase
{
    use RefreshDatabase;

    public function test_tokens_tab_shows_copyable_website_token_details(): void
    {
        $user = User::factory()->create();

        Website::create([
            'key' => 'hipl',
            'name' => 'HIPL',
            'api_token' => 'secret-token',
        ]);

        $response = $this->actingAs($user)->get('/dashboard?tab=tokens');

        $response->assertOk();
        $response->assertSee('Website API Tokens');
        $response->assertSee('secret-token');
        $response->assertSee('/api/webhooks/elementor/hipl?token=secret-token');
        $response->assertSee('Copy URL');
    }
}
