34 lines
1.0 KiB
Dart
34 lines
1.0 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/pipelines/pipeline_format.dart';
|
|
import 'package:pipelines_app/features/runs/domain/run_models.dart';
|
|
|
|
void main() {
|
|
final now = DateTime.utc(2026, 10, 21, 12, 10);
|
|
|
|
test('a finished run reads run, local time and duration, as the web', () {
|
|
final run = {
|
|
'id': 7,
|
|
'created_at': '2026-10-21T12:00:00Z',
|
|
'finished_at': '2026-10-21T12:04:12Z',
|
|
};
|
|
expect(
|
|
runRowMetaText(run, now),
|
|
'run 7 · ${formatLocalTimestamp('2026-10-21T12:00:00Z')} · 4m 12s',
|
|
);
|
|
});
|
|
|
|
test('an executing run reads its elapsed time instead', () {
|
|
final run = {
|
|
'id': 8,
|
|
'executing': true,
|
|
'created_at': '2026-10-21T12:07:00Z',
|
|
};
|
|
expect(runRowMetaText(run, now), 'run 8 · 3m 0s');
|
|
});
|
|
|
|
test('unusable timestamps are omitted, never printed blank', () {
|
|
expect(runRowMetaText({'id': 9, 'created_at': 'nope'}, now), 'run 9');
|
|
expect(runRowMetaText({'id': 9}, now), 'run 9');
|
|
});
|
|
}
|