<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminJsCopyFailuresShouldUseToastErrorFirstTest extends TestCase
{
    use RefreshDatabase;

    public function test_copy_failures_should_use_toast_error_first(): void
    {
        $js = file_get_contents(public_path('js/admin.js'));
        $this->assertIsString($js);

        // 复制失败时应优先 toastError（alert 作为降级）
        // 允许通过 wrapper（toastCopyFailed）间接调用 toastError。
        $this->assertTrue(
            str_contains($js, "toastError('复制失败") || str_contains($js, 'toastCopyFailed('),
            'copy failures should use toastError (directly or via toastCopyFailed wrapper)'
        );
    }
}
