import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart'; import 'package:pipelines_app/features/artifacts/domain/artifact_selection.dart'; import 'artifact_fixtures.dart'; List _names(List records) => [ for (final record in records) record.name, ]; void main() { test('the server group decides deliverable versus debugging file', () { final records = [ ArtifactRecord.fromJson( artifact('notes.md', extra: const {'group': 'debug'}), ), ArtifactRecord.fromJson( artifact('history.md', extra: const {'group': 'deliverable'}), ), ArtifactRecord.fromJson( artifact('public/report.png', extra: const {'group': 'deliverable'}), ), ]; expect(_names(stageArtifactsFrom(records)), [ 'history.md', 'public/report.png', ]); expect(_names(systemArtifactsFrom(records)), ['notes.md']); }); test('an older server without groups falls back to the filename rule', () { final records = [ for (final name in [ 'input.md', 'memory.md', 'history.md', 'output.md', 'session.html', 'private/shot.png', 'public/report.html', 'legacy-report.txt', ]) ArtifactRecord.fromJson(artifact(name)), ]; expect(_names(stageArtifactsFrom(records)), [ 'public/report.html', 'legacy-report.txt', ]); expect(_names(systemArtifactsFrom(records)), [ 'input.md', 'memory.md', 'history.md', 'output.md', 'session.html', 'private/shot.png', ]); }); }