feat(bot): help:rebuild-knowledge — индексация статей в knowledge_chunks + schedule 04:30
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('перечитывает resources/help и заполняет knowledge_chunks с нуля', function () {
|
||||
// Мусорная строка от прошлой индексации — должна исчезнуть (полная перезаливка).
|
||||
DB::table('knowledge_chunks')->insert([
|
||||
'source_path' => 'help/deleted-article.md', 'title' => 'Старая', 'topics' => '',
|
||||
'chunk_index' => 0, 'content' => 'мусор', 'created_at' => now(), 'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$this->artisan('help:rebuild-knowledge')->assertExitCode(0);
|
||||
|
||||
expect(DB::table('knowledge_chunks')->where('source_path', 'help/deleted-article.md')->count())->toBe(0)
|
||||
->and(DB::table('knowledge_chunks')->where('title', 'Что такое проект')->count())->toBeGreaterThan(0)
|
||||
->and(DB::table('knowledge_chunks')->where('title', 'Тарифы и списания')->count())->toBeGreaterThan(0);
|
||||
});
|
||||
Reference in New Issue
Block a user