feat(bot): таблица bot_dialogs — журнал диалогов бота
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('bot_dialogs принимает запись входа и выхода', function () {
|
||||
DB::table('bot_dialogs')->insert([
|
||||
'jivo_chat_id' => 'chat-1',
|
||||
'direction' => 'in',
|
||||
'message' => 'что такое проект?',
|
||||
'created_at' => now(),
|
||||
]);
|
||||
DB::table('bot_dialogs')->insert([
|
||||
'jivo_chat_id' => 'chat-1',
|
||||
'direction' => 'out',
|
||||
'message' => 'Проект — это…',
|
||||
'matched_chunks' => json_encode([1, 2]),
|
||||
'latency_ms' => 2100,
|
||||
'escalated' => false,
|
||||
'created_at' => now(),
|
||||
]);
|
||||
|
||||
expect(DB::table('bot_dialogs')->where('jivo_chat_id', 'chat-1')->count())->toBe(2);
|
||||
});
|
||||
Reference in New Issue
Block a user