<?php

namespace MintyPHP\Tests\Architecture;

use PHPUnit\Framework\TestCase;

final class DetailActionPolicyRuntimeContractTest extends TestCase
{
    use ProjectFileAssertionSupport;

    public function testDetailPageFactoryUsesActionPolicyModule(): void
    {
        $content = $this->readProjectFile('web/js/core/app-detail-page-factory.js');

        $this->assertStringContainsString(
            "import { initDetailActionPolicy } from './app-details-action-policy.js';",
            $content
        );
        $this->assertStringContainsString('const actionPolicy = initDetailActionPolicy(', $content);
        $this->assertStringContainsString('actionPolicy.isSubmitting()', $content);
    }
}
