- Added tone instruction retrieval to SupportReplyService. - Improved user feedback when no relevant article is found. - Included article URL and tone instruction in LLM prompt. - Updated response format to include source information. - Enhanced article management UI with search functionality and editing capabilities. - Introduced a new API endpoint for nearest articles based on vector search. - Added confidence badge component to display article confidence levels. - Implemented tests for article searching, editing, and nearest article API. - Removed obsolete .htaccess file.
60 lines
1.8 KiB
PHP
60 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Livewire\Admin\ArticleManager;
|
|
use App\Models\Article;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Queue;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
class ArticleManagerTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_it_can_search_articles(): void
|
|
{
|
|
Article::withoutEvents(function (): void {
|
|
Article::query()->create([
|
|
'title' => 'DNS instellen',
|
|
'content' => 'Managed DNS handleiding',
|
|
]);
|
|
|
|
Article::query()->create([
|
|
'title' => 'E-mail wachtwoord wijzigen',
|
|
'content' => 'Mailbox instellingen',
|
|
]);
|
|
});
|
|
|
|
Livewire::test(ArticleManager::class)
|
|
->set('search', 'Managed DNS')
|
|
->assertSee('DNS instellen')
|
|
->assertDontSee('E-mail wachtwoord wijzigen');
|
|
}
|
|
|
|
public function test_it_can_edit_article_title_and_content(): void
|
|
{
|
|
Queue::fake();
|
|
config(['services.embedding.queue_embeddings' => true]);
|
|
|
|
$article = Article::withoutEvents(fn () => Article::query()->create([
|
|
'title' => 'Oude titel',
|
|
'content' => 'Oude inhoud',
|
|
]));
|
|
|
|
Livewire::test(ArticleManager::class)
|
|
->call('startEdit', $article->id)
|
|
->assertSet('editingArticleId', $article->id)
|
|
->set('editTitle', 'Nieuwe titel')
|
|
->set('editContent', 'Nieuwe inhoud voor het artikel')
|
|
->call('saveEdit')
|
|
->assertSet('editingArticleId', null);
|
|
|
|
$article->refresh();
|
|
|
|
$this->assertSame('Nieuwe titel', $article->title);
|
|
$this->assertSame('Nieuwe inhoud voor het artikel', $article->content);
|
|
}
|
|
}
|