Files
pipelines/app/test/features/chat/domain/chat_default_name_test.dart
T
alan b1fcdcf2c3 Chat: unnamed chats take the harness title, harness default per folder, word-safe tables, Send later
- New chat: a cleared Name creates the chat without an operator title; the
  list shows the harness's own title, or the default name until it has one.
  The server no longer records "New chat" for a blank title and OpenCode
  is created without a title so it names the session itself.
- New chat harness defaults to the one last used in the chosen folder,
  else anywhere, else OpenCode; remembered on the device per server.
- Markdown tables wrap at word boundaries and never go below a column's
  longest word (tokens over ~40 characters may break); a table whose words
  cannot fit scrolls sideways with the code block affordance.
- Composer: right-click, long-press, Shift+F10 or the context menu key on
  Send opens Send later... (30 min, 1 h, tomorrow 9:00, usage reset, pick a
  time), sent through the same path with send_at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 19:55:40 +00:00

53 lines
1.6 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/domain/chat_default_name.dart';
import 'package:pipelines_app/features/chat/domain/chat_sessions.dart';
void main() {
test('an operator or harness title is shown as is', () {
expect(
chatSessionTitle({'id': 's', 'title': 'Fix login', 'directory': '/a'}),
'Fix login',
);
});
test(
'an untitled chat shows the default name until the harness names it',
() {
expect(
chatSessionTitle({
'id': 'ses_1',
'title': '',
'directory': '/work/pipelines',
'backend': 'codex',
}),
'Pipelines Codex',
);
expect(
chatSessionTitle({
'id': 'ses_2',
'title': 'New session - 2026-12-02T09:00:00.000Z',
'directory': '/work/site',
'backend': 'opencode',
}),
'Site OpenCode',
);
// No backend field: an older server's chats are OpenCode.
expect(
chatSessionTitle({'id': 'ses_3', 'directory': '/work/site'}),
'Site OpenCode',
);
},
);
test('a row without a directory still falls back to its id', () {
expect(chatSessionTitle({'id': 'ses_abc'}), 'ses_abc');
expect(chatSessionTitle(const {}), 'Untitled chat');
});
test('only blank titles and the placeholder count as unnamed', () {
expect(chatHarnessTitle(' '), isNull);
expect(chatHarnessTitle('Child session - 2026-01-01T00:00:00Z'), isNull);
expect(chatHarnessTitle('New session notes'), 'New session notes');
});
}