merge(app): land pipeline-miniature micro-slice
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/pipelines/widgets/pipeline_list_panel.dart';
|
||||
|
||||
import 'fixtures.dart';
|
||||
import 'test_helpers.dart';
|
||||
|
||||
/// The list row's recorded flow cue: the reply's `shape` is drawn through the
|
||||
/// shared graph layout, and nothing is invented or fetched when it is absent.
|
||||
void main() {
|
||||
group('pipeline row miniature', () {
|
||||
testWidgets('a recorded shape draws the row miniature', (tester) async {
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = gatewayFor(
|
||||
fixture,
|
||||
summaries: [
|
||||
pipelineSummary(id: 7, name: 'Shape', stages: 2)
|
||||
..['shape'] = reviewGraph(),
|
||||
],
|
||||
);
|
||||
|
||||
await pumpWide(tester, gateway);
|
||||
|
||||
expect(find.byKey(const Key('pipeline-mini-7')), findsOneWidget);
|
||||
// The cue is additive: the recorded metadata line is unchanged.
|
||||
expect(find.text('id 7 · v1 · 2 stages'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a summary without a shape draws no miniature', (tester) async {
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = gatewayFor(
|
||||
fixture,
|
||||
summaries: [pipelineSummary(id: 8, name: 'Bare')],
|
||||
);
|
||||
|
||||
await pumpWide(tester, gateway);
|
||||
|
||||
expect(find.byType(PipelineMiniGraph), findsNothing);
|
||||
expect(find.byKey(const Key('pipeline-mini-8')), findsNothing);
|
||||
expect(find.text('id 8 · v1 · 1 stage'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a miniature never fetches another origin or pipeline detail', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
final shape = reviewGraph();
|
||||
final stage = (shape['stages'] as List).first as Map<String, dynamic>;
|
||||
// A recorded external preview must be ignored: the row draws only the
|
||||
// recorded flow and never requests another origin.
|
||||
stage['preview'] = 'https://images.example.test/mini.png';
|
||||
stage['url'] = 'https://images.example.test/mini.png';
|
||||
final gateway = gatewayFor(
|
||||
fixture,
|
||||
summaries: [
|
||||
pipelineSummary(id: 9, name: 'Remote', stages: 2)..['shape'] = shape,
|
||||
],
|
||||
);
|
||||
|
||||
await pumpWide(tester, gateway);
|
||||
|
||||
expect(find.byKey(const Key('pipeline-mini-9')), findsOneWidget);
|
||||
expect(find.byType(Image), findsNothing);
|
||||
expect(gateway.callsOf('get_pipeline'), isEmpty);
|
||||
expect(
|
||||
gateway.calls.map((call) => call.type),
|
||||
everyElement(isIn(<String>['list_pipelines', 'list_runs'])),
|
||||
);
|
||||
expect(find.text('id 9 · v1 · 2 stages'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user