- 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.
48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Article;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class ArticleApiTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_it_creates_article_with_note_and_allowed_actions(): void
|
|
{
|
|
$response = $this->postJson('/api/articles', [
|
|
'title' => 'DNS instellen',
|
|
'content' => 'Stap 1...',
|
|
'note' => 'Alleen voor DNS vragen',
|
|
'allowed_actions' => ['domain_inf'],
|
|
]);
|
|
|
|
$response->assertStatus(201);
|
|
|
|
$article = Article::query()->first();
|
|
$this->assertNotNull($article);
|
|
$this->assertSame('Alleen voor DNS vragen', $article->note);
|
|
$this->assertSame(['domain_inf'], $article->allowed_actions);
|
|
}
|
|
|
|
public function test_it_rejects_invalid_allowed_action(): void
|
|
{
|
|
$response = $this->postJson('/api/articles', [
|
|
'title' => 'DNS instellen',
|
|
'content' => 'Stap 1...',
|
|
'allowed_actions' => ['invalid_action'],
|
|
]);
|
|
|
|
$response->assertStatus(422);
|
|
}
|
|
|
|
public function test_it_lists_articles(): void
|
|
{
|
|
Article::query()->create(['title' => 'A', 'content' => 'B']);
|
|
$response = $this->getJson('/api/articles');
|
|
$response->assertOk();
|
|
}
|
|
}
|