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:
36
tests/Feature/QuickReplyAdminTest.php
Normal file
36
tests/Feature/QuickReplyAdminTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Livewire\Admin\QuickReplyManager;
|
||||
use App\Models\QuickReply;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
class QuickReplyAdminTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_it_can_create_and_update_quick_reply(): void
|
||||
{
|
||||
Livewire::test(QuickReplyManager::class)
|
||||
->set('title', 'DNS Basis')
|
||||
->set('content', 'Gebruik deze stappen')
|
||||
->set('isActive', true)
|
||||
->call('save');
|
||||
|
||||
$reply = QuickReply::query()->first();
|
||||
$this->assertNotNull($reply);
|
||||
|
||||
Livewire::test(QuickReplyManager::class)
|
||||
->set("editRows.{$reply->id}.title", 'DNS Geupdated')
|
||||
->set("editRows.{$reply->id}.content", 'Nieuwe content')
|
||||
->set("editRows.{$reply->id}.is_active", false)
|
||||
->call('updateQuickReply', $reply->id);
|
||||
|
||||
$reply->refresh();
|
||||
$this->assertSame('DNS Geupdated', $reply->title);
|
||||
$this->assertFalse($reply->is_active);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user