test(draw): cover the 2.9.0 drawing-card additions to clear the coverage floor
The drawing-card feature batch (icon/image/compare/graph/d2 cards, --stdin, tool resolution) added widget + wiring code that dipped total coverage under the 95% floor — surfaced by `make release` (push-check skips coverage). Cover the gaps: ProblemsController.refresh, every SVG shape-type bbox + the style vocabulary, _spawnD2 via a real /bin/cat, the icon-show bus path + error branches, and quad/arc/close marker paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,21 @@ void main() {
|
||||
expect(published.single.data['svg'], '<svg id="raw"/>');
|
||||
});
|
||||
|
||||
test('an empty --file value is a userError', () async {
|
||||
wire();
|
||||
final r = await draw('');
|
||||
expect(r.ok, isFalse);
|
||||
expect(r.error?.kind, IpcErrorKind.userError);
|
||||
});
|
||||
|
||||
test('valid JSON that is not an object is a userError', () async {
|
||||
wire();
|
||||
files['arr.json'] = '[1,2,3]';
|
||||
final r = await draw('arr.json');
|
||||
expect(r.error?.kind, IpcErrorKind.userError);
|
||||
expect(published, isEmpty);
|
||||
});
|
||||
|
||||
test('a missing file → notFound, nothing published', () async {
|
||||
wire();
|
||||
final r = await draw('nope.json');
|
||||
|
||||
@@ -84,6 +84,19 @@ void main() {
|
||||
expect(published.single.data['color'], 'red');
|
||||
});
|
||||
|
||||
test('an invalid card-level --color is an honest userError', () async {
|
||||
wire();
|
||||
final r = await show(['gear'], flags: {'color': 'notacolor'});
|
||||
expect(r.error?.kind, IpcErrorKind.userError);
|
||||
expect(published, isEmpty);
|
||||
});
|
||||
|
||||
test('a missing --file is notFound', () async {
|
||||
wire();
|
||||
final r = await show([], flags: {'file': 'gone.json'});
|
||||
expect(r.error?.kind, IpcErrorKind.notFound);
|
||||
});
|
||||
|
||||
test('an unknown glyph name is an honest userError', () async {
|
||||
wire();
|
||||
final r = await show(['notaglyph']);
|
||||
@@ -97,6 +110,12 @@ void main() {
|
||||
expect(r.error?.kind, IpcErrorKind.userError);
|
||||
});
|
||||
|
||||
test('an unknown icon inside a --file entry is a userError', () async {
|
||||
wire(files: {'i.json': '[{"icon":"notaglyph"}]'});
|
||||
final r = await show([], flags: {'file': 'i.json'});
|
||||
expect(r.error?.kind, IpcErrorKind.userError);
|
||||
});
|
||||
|
||||
test('a malformed --file is a userError', () async {
|
||||
wire(files: {'i.json': 'not json'});
|
||||
final r = await show([], flags: {'file': 'i.json'});
|
||||
|
||||
Reference in New Issue
Block a user