feat(app): run graph statuses are coloured and taken routes are numbered in run order
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/graph/domain/run_graph_state.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
|
||||
import 'package:pipelines_app/ui/status/run_status_icon.dart';
|
||||
|
||||
void main() {
|
||||
test('taken routes carry their place in the run, loops every pass', () {
|
||||
final state = runGraphState({
|
||||
'steps': [
|
||||
{'stage': 'plan', 'outcome': 'success', 'target': 'build'},
|
||||
{'stage': 'build', 'outcome': 'retry', 'target': 'build'},
|
||||
{'stage': 'build', 'outcome': 'retry', 'target': 'build'},
|
||||
{'stage': 'build', 'outcome': 'success', 'target': '#success'},
|
||||
],
|
||||
});
|
||||
expect(state.routeOrder('plan', 'success', 'build'), [1]);
|
||||
expect(state.routeOrder('build', 'retry', 'build'), [2, 3]);
|
||||
expect(state.routeOrder('build', 'success', '#success'), [4]);
|
||||
expect(state.routeOrder('plan', 'error', '#failure'), isEmpty);
|
||||
});
|
||||
|
||||
test('a recorded status colours by what it means', () {
|
||||
expect(graphStatusState('completed'), 'succeeded');
|
||||
expect(graphStatusState('blocked'), 'failed');
|
||||
expect(graphStatusState('running · 2m'), 'running');
|
||||
expect(graphStatusState('waiting'), 'waiting');
|
||||
expect(graphStatusState('mystery'), 'unknown');
|
||||
expect(runStatusColor('succeeded'), CupertinoColors.systemGreen);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user