Some checks are pending
CI / Format · Analyze · Test (push) Waiting to run
Help authors spot missing alt text, low contrast, and dense slides in the editor, with an optional confirmation step before export when issues remain. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.6 KiB
Dart
46 lines
1.6 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:ocideck/models/markdown_validation.dart';
|
|
import 'package:ocideck/models/slide_quality.dart';
|
|
import 'package:ocideck/services/quality_export_policy.dart';
|
|
|
|
void main() {
|
|
group('QualityExportPolicy', () {
|
|
test('allows export when disabled even with issues', () {
|
|
const policy = QualityExportPolicy(enabled: false);
|
|
const result = SlideQualityResult([
|
|
SlideQualityIssue(
|
|
slideIndex: 0,
|
|
kind: SlideQualityIssueKind.missingAltCaption,
|
|
category: SlideQualityCategory.altText,
|
|
severity: MarkdownValidationSeverity.warning,
|
|
),
|
|
]);
|
|
|
|
expect(policy.evaluate(result).allowed, isTrue);
|
|
});
|
|
|
|
test('allows export when there are no issues', () {
|
|
const policy = QualityExportPolicy();
|
|
expect(policy.evaluate(const SlideQualityResult([])).allowed, isTrue);
|
|
});
|
|
|
|
test('requires acknowledgement when enabled and issues exist', () {
|
|
const policy = QualityExportPolicy();
|
|
const result = SlideQualityResult([
|
|
SlideQualityIssue(
|
|
slideIndex: 0,
|
|
kind: SlideQualityIssueKind.missingAltCaption,
|
|
category: SlideQualityCategory.altText,
|
|
severity: MarkdownValidationSeverity.warning,
|
|
),
|
|
]);
|
|
|
|
final pending = policy.evaluate(result);
|
|
expect(pending.allowed, isFalse);
|
|
expect(pending.warningCount, 1);
|
|
expect(pending.reason, contains('kwaliteitsproblemen'));
|
|
|
|
expect(policy.evaluate(result, acknowledged: true).allowed, isTrue);
|
|
});
|
|
});
|
|
}
|