todo-app/test/mcp/mcp_no_repo_test.dart
Krzysztof kuhy Rudnicki 9d2a5a0bd3
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
list_tasks no_repo lists repo-less notes
The board reads open notes through list_tasks, which hides notes
without a repo, so kuhy's ideas never reached it.

Todo: 475dc1d1
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWXu5EV5tPkCTEu6nxf
2026-11-19 10:53:18 +01:00

56 lines
1.7 KiB
Dart

// list_tasks `no_repo: true` lists the open notes that have no repo (ideas),
// which the board shows in its Yours lane; without it they stay invisible.
import 'package:flutter_test/flutter_test.dart';
import 'package:mcp_dart/mcp_dart.dart';
import 'package:todo/data/note.dart';
import 'mcp_harness.dart';
void main() {
late McpHarness h;
late McpClient c;
setUp(() async {
h = McpHarness();
await h.start();
c = await h.connect();
});
tearDown(() => h.dispose());
Future<void> idea(String id, String text, Status status) async {
final now = DateTime.now();
await h.session.repository.upsert(
Note(
id: id,
text: text,
status: status,
priority: Priority.medium,
createdAt: now,
updatedAt: now,
),
);
}
test('no_repo lists only open repo-less notes', () async {
await idea('11111111-aaaa', 'open idea', Status.todo);
await idea('22222222-aaaa', 'finished idea', Status.done);
await h.call(c, 'add_task', {'repo': 'kuhyx/x', 'title': 'repo task'});
final plain = await h.call(c, 'list_tasks', {});
expect(plain, isNot(contains('open idea')));
final ideas = await h.call(c, 'list_tasks', {'no_repo': true});
expect(ideas.trim().split('\n'), hasLength(1));
expect(ideas, allOf(contains('11111111'), contains('open idea')));
expect(ideas, isNot(contains('repo task')));
});
test('no_repo with nothing to list says so', () async {
expect(await h.call(c, 'list_tasks', {'no_repo': true}), 'no tasks match');
});
test('no_repo is named in the tool text', () async {
final tools = (await c.listTools()).tools;
final list = tools.singleWhere((t) => t.name == 'list_tasks');
expect(list.description, contains('no_repo'));
});
}