test sweep: cover daemon editor / files / pane / pql commands (T-91)
test / unit + widget + golden + a11y (push) Failing after 31s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m1s
test / unit + widget + golden + a11y (push) Failing after 31s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m1s
Extends the four existing daemon command suites with the verbs + error paths the originals didn't reach: - editor_commands_test (12 new): unreadable-path FileSystemException catch, editor.active with no buffer, editor.activate requires + validates id, editor.read no-active / unknown-id, editor.set-selection no-active / clamped, editor.set-content with + without selection, editor.save no-active, editor.close requires + validates id. - files_commands_test (8 new): files.read happy + missing-path + empty-path + outside-root + missing-file, files.ls outside-root, files.watch idempotent, FilesService.atCwd resolver. - pane_commands_test (10 new): argv-non-string rejection, unknown kind rejection, env passthrough, close / write / focus / resize missing-id and unknown-id validations, write requires bytes_b64 or text, malformed base64 rejection. - pql_commands_test (14 new): pql.files glob + limit, pql.backlinks happy, pql.outlinks missing, pql.tags, pql.query + pql.search happy paths + missing-arg user_error, pql.decisions.read missing + happy, pql.decisions.show with --with-refs / --with-tickets, pql.decisions.list domain filter, pql.tickets.list multi-filter, pql.tickets.show missing + happy, pql.tickets.status missing + partial-args, pql.tickets.board with team. Coverage: src/daemon/editor_commands.dart 64/100 -> 88/100; files_commands.dart 33/70 -> 64/70 (91%); pane_commands.dart 66/92 -> 78/92 (85%); pql_commands.dart 62/149 -> 105/149 (70% — remaining 44 lines are the per-command PqlException catch branches that only fire when the pql subprocess itself fails mid-call). Total coverage 77.92% -> 79.26%; floor bumped to 79. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -111,5 +111,86 @@ void main() {
|
||||
expect(r.ok, isTrue);
|
||||
expect(r.data['subscribed'], isTrue);
|
||||
});
|
||||
|
||||
test('pane.spawn rejects non-string argv entries', () async {
|
||||
final r = await call('pane.spawn', const {
|
||||
'argv': ['/bin/sh', 42]
|
||||
});
|
||||
expect(r.ok, isFalse);
|
||||
expect(r.error!.message, contains('strings'));
|
||||
});
|
||||
|
||||
test('pane.spawn rejects an unknown kind', () async {
|
||||
final r = await call('pane.spawn', const {
|
||||
'argv': ['/bin/cat'],
|
||||
'kind': 'no-such-kind',
|
||||
});
|
||||
expect(r.ok, isFalse);
|
||||
expect(r.error!.kind, 'user_error');
|
||||
});
|
||||
|
||||
test('pane.spawn passes env through as strings', () async {
|
||||
final r = await call('pane.spawn', {
|
||||
'argv': const ['/bin/sh', '-c', 'env'],
|
||||
'env': const {'FOO': 'bar'},
|
||||
});
|
||||
expect(r.ok, isTrue, reason: r.error?.message);
|
||||
});
|
||||
|
||||
test('pane.close requires id and validates it', () async {
|
||||
final missing = await call('pane.close', const {});
|
||||
expect(missing.ok, isFalse);
|
||||
expect(missing.error!.kind, 'user_error');
|
||||
final unknown = await call('pane.close', const {'id': 'p_404'});
|
||||
expect(unknown.ok, isFalse);
|
||||
expect(unknown.error!.kind, 'not_found');
|
||||
});
|
||||
|
||||
test('pane.write requires id and validates it', () async {
|
||||
final missing = await call('pane.write', const {'text': 'x'});
|
||||
expect(missing.ok, isFalse);
|
||||
expect(missing.error!.kind, 'user_error');
|
||||
});
|
||||
|
||||
test('pane.write requires bytes_b64 or text', () async {
|
||||
final spawn = await call('pane.spawn', {
|
||||
'argv': const ['/bin/cat'],
|
||||
});
|
||||
final id = spawn.data['id']! as String;
|
||||
final r = await call('pane.write', {'id': id});
|
||||
expect(r.ok, isFalse);
|
||||
expect(r.error!.message, contains('bytes_b64 or text'));
|
||||
});
|
||||
|
||||
test('pane.write rejects malformed base64', () async {
|
||||
final spawn = await call('pane.spawn', {
|
||||
'argv': const ['/bin/cat'],
|
||||
});
|
||||
final id = spawn.data['id']! as String;
|
||||
final r = await call('pane.write', {'id': id, 'bytes_b64': 'not-base64!!!'});
|
||||
expect(r.ok, isFalse);
|
||||
expect(r.error!.message, contains('base64'));
|
||||
});
|
||||
|
||||
test('pane.resize requires all three of id / cols / rows', () async {
|
||||
final r = await call('pane.resize', const {'id': 'p_1'});
|
||||
expect(r.ok, isFalse);
|
||||
expect(r.error!.kind, 'user_error');
|
||||
});
|
||||
|
||||
test('pane.resize on unknown id is not-found', () async {
|
||||
final r = await call('pane.resize', const {'id': 'p_404', 'cols': 80, 'rows': 24});
|
||||
expect(r.ok, isFalse);
|
||||
expect(r.error!.code, IpcExitCode.notFound);
|
||||
});
|
||||
|
||||
test('pane.focus requires id and validates it', () async {
|
||||
final missing = await call('pane.focus', const {});
|
||||
expect(missing.ok, isFalse);
|
||||
expect(missing.error!.kind, 'user_error');
|
||||
final unknown = await call('pane.focus', const {'id': 'p_404'});
|
||||
expect(unknown.ok, isFalse);
|
||||
expect(unknown.error!.kind, 'not_found');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user