dew/packages/cli/test/cli_test.dart
Chris Hendrickson 0ad1fae213 chore: 1.0 release prep
Metadata:
- Bump dew CLI version 0.0.1 → 1.0.0
- Add repository + issue_tracker URLs to all pubspec.yaml files
- Switch inter-package path deps to versioned deps (^1.0.0)
- Remove publish_to: none from all packages
- Add MIT LICENSE to root and all packages
- Confirm all four pub.dev names available (dew, dew_core, dew_kanban, dew_mcp)

Documentation:
- Add CHANGELOG.md (Keep a Changelog format, full 1.0.0 feature history)
- Overhaul README.md (pitch, pub.dev badge, quick-start, feature sections)
- Add TUI section + full keybinding tables to docs/features/kanban.md
- Add CONTRIBUTING.md (setup, test, lint, branch strategy, command guide)

Tests:
- Add packages/cli/test/cli_test.dart (6 smoke tests)
- Add packages/kanban/test/integration_test.dart (6 TicketStore e2e tests)
- Expand packages/mcp/test/mcp_test.dart (5 tool registration tests)
- Add dew_kanban as dev dependency in packages/mcp/pubspec.yaml
- 57/57 tests passing

Code quality:
- dart format applied across all 23 changed source files
- dart analyze: zero errors, zero warnings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-25 15:58:54 -04:00

55 lines
1.7 KiB
Dart

import 'package:args/command_runner.dart';
import 'package:dew_core/dew_core.dart';
import 'package:dew_kanban/dew_kanban.dart' as kanban;
import 'package:dew_mcp/dew_mcp.dart' as mcp;
import 'package:test/test.dart';
/// Builds the same CommandRunner as bin/dew.dart without actually running it.
CommandRunner<void> buildRunner() {
final commandRegistry = CommandRegistry();
kanban.registerCommands(commandRegistry);
mcp.registerCommands(commandRegistry);
final runner = CommandRunner<void>('dew', 'A project management tool.');
runner.addCommand(InitCommand(commandRegistry.initHooks));
for (final command in commandRegistry.commands) {
runner.addCommand(command);
}
return runner;
}
void main() {
group('CLI CommandRunner', () {
test('builds without throwing', () {
expect(buildRunner, returnsNormally);
});
test('has kanban, init, and mcp commands registered', () {
final runner = buildRunner();
expect(runner.commands.keys, containsAll(['kanban', 'init', 'mcp']));
});
test('--help flag does not throw', () async {
final runner = buildRunner();
await expectLater(runner.run(['--help']), completes);
});
test('unknown command throws UsageException', () async {
final runner = buildRunner();
await expectLater(
runner.run(['totally-unknown-command']),
throwsA(isA<UsageException>()),
);
});
test('kanban subcommand --help does not throw', () async {
final runner = buildRunner();
await expectLater(runner.run(['help', 'kanban']), completes);
});
test('mcp subcommand --help does not throw', () async {
final runner = buildRunner();
await expectLater(runner.run(['help', 'mcp']), completes);
});
});
}