<?php

namespace Tests\Feature;

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

class AdminJsTempButtonFeedbackShouldBeDefinedBeforeCopyRunIdHandlerTest extends TestCase
{
    use RefreshDatabase;

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

        $posTemp = strpos($js, 'function tempButtonFeedback');
        $posRunId = strpos($js, 'copy-run-id');

        $this->assertNotFalse($posTemp);
        $this->assertNotFalse($posRunId);

        $this->assertTrue($posTemp < $posRunId, 'tempButtonFeedback should be defined before copy-run-id handler');
    }
}
