feat(chat): журнал разговоров переезжает с Jivo на свой чат
jivo_chat_id -> chat_id + добавлены source/user_id/ip (спека 2026-07-13-own-chat-widget-design §5). Историческая миграция создания таблицы не тронута. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -9,13 +9,13 @@ uses(RefreshDatabase::class);
|
||||
|
||||
it('bot_dialogs принимает запись входа и выхода', function () {
|
||||
DB::table('bot_dialogs')->insert([
|
||||
'jivo_chat_id' => 'chat-1',
|
||||
'chat_id' => 'chat-1',
|
||||
'direction' => 'in',
|
||||
'message' => 'что такое проект?',
|
||||
'created_at' => now(),
|
||||
]);
|
||||
DB::table('bot_dialogs')->insert([
|
||||
'jivo_chat_id' => 'chat-1',
|
||||
'chat_id' => 'chat-1',
|
||||
'direction' => 'out',
|
||||
'message' => 'Проект — это…',
|
||||
'matched_chunks' => json_encode([1, 2]),
|
||||
@@ -24,5 +24,19 @@ it('bot_dialogs принимает запись входа и выхода', fun
|
||||
'created_at' => now(),
|
||||
]);
|
||||
|
||||
expect(DB::table('bot_dialogs')->where('jivo_chat_id', 'chat-1')->count())->toBe(2);
|
||||
expect(DB::table('bot_dialogs')->where('chat_id', 'chat-1')->count())->toBe(2);
|
||||
});
|
||||
|
||||
it('журнал разговоров хранит номер разговора, откуда пришёл и кто клиент', function () {
|
||||
$columns = DB::select("
|
||||
SELECT column_name FROM information_schema.columns
|
||||
WHERE table_name = 'bot_dialogs'
|
||||
");
|
||||
$names = array_map(fn ($c) => $c->column_name, $columns);
|
||||
|
||||
expect($names)->toContain('chat_id')
|
||||
->and($names)->toContain('source')
|
||||
->and($names)->toContain('user_id')
|
||||
->and($names)->toContain('ip')
|
||||
->and($names)->not->toContain('jivo_chat_id');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user