Add unit and feature tests for ticket processing and article management
- Implement Fake repositories and services for testing purposes. - Create tests for Article API including creation, validation, and listing. - Develop ProcessTicketJobFlowTest to validate ticket processing logic. - Add QuickReplyAdminTest for creating and updating quick replies. - Implement TicketAndArticleModelTest to ensure proper cascading deletes and credential encryption. - Create TicketIngestionTest for ticket creation and job dispatching. - Add TicketShowPageTest to verify rendering of quick replies and tool calls. - Implement unit tests for ClassifierPromptBuilder, EmbeddingService, LlmJsonDecoder, QuickReplyResolver, SupportReplyService, TicketResultPayloadBuilder, TicketToolCallService, and ToolCallRequestValidator.
This commit is contained in:
45
tests/Unit/ToolCallRequestValidatorTest.php
Normal file
45
tests/Unit/ToolCallRequestValidatorTest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Services\ToolCallRequestValidator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ToolCallRequestValidatorTest extends TestCase
|
||||
{
|
||||
public function test_it_validates_domain_inf_tool_call(): void
|
||||
{
|
||||
$validator = new ToolCallRequestValidator;
|
||||
$validated = $validator->validate([
|
||||
'action' => 'domain_inf',
|
||||
'parameters' => ['sld' => 'Example', 'tld' => 'NL'],
|
||||
'reason' => 'Needed',
|
||||
]);
|
||||
|
||||
$this->assertSame([
|
||||
'action' => 'domain_inf',
|
||||
'parameters' => ['sld' => 'example', 'tld' => 'nl'],
|
||||
'reason' => 'Needed',
|
||||
], $validated);
|
||||
}
|
||||
|
||||
public function test_it_rejects_missing_parameters(): void
|
||||
{
|
||||
$validator = new ToolCallRequestValidator;
|
||||
|
||||
$this->assertNull($validator->validate([
|
||||
'action' => 'domain_inf',
|
||||
'parameters' => ['sld' => 'example'],
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_it_rejects_unknown_action(): void
|
||||
{
|
||||
$validator = new ToolCallRequestValidator;
|
||||
|
||||
$this->assertNull($validator->validate([
|
||||
'action' => 'dns_update',
|
||||
'parameters' => ['sld' => 'example', 'tld' => 'nl'],
|
||||
]));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user