No content changes: git diff --ignore-all-space over these files is empty. The churn came from editing on Windows against a repo checked out with LF.
60 lines
1.9 KiB
Dart
60 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:app_pfm_ocr_v2/features/editor/widgets/product_dropdown_card.dart';
|
|
|
|
void main() {
|
|
final matches = [
|
|
{'no_sku': '1', 'nama_item': 'Produk A', 'confidence': 0.9},
|
|
];
|
|
|
|
testWidgets('shows the confidence score when there is a real automatic match', (tester) async {
|
|
await tester.pumpWidget(MaterialApp(
|
|
home: Scaffold(
|
|
body: ProductDropdownCard(
|
|
selectedSku: '1',
|
|
matches: matches,
|
|
hasAutoMatch: true,
|
|
onSkuChanged: (_) {},
|
|
),
|
|
),
|
|
));
|
|
|
|
expect(find.text('Confidence Score'), findsOneWidget);
|
|
expect(find.textContaining('%'), findsOneWidget);
|
|
expect(find.textContaining('rekomendasi otomatis'), findsNothing);
|
|
});
|
|
|
|
testWidgets('shows a manual-selection notice instead of a fake confidence score', (tester) async {
|
|
await tester.pumpWidget(MaterialApp(
|
|
home: Scaffold(
|
|
body: ProductDropdownCard(
|
|
selectedSku: '1',
|
|
matches: matches,
|
|
hasAutoMatch: false,
|
|
onSkuChanged: (_) {},
|
|
),
|
|
),
|
|
));
|
|
|
|
expect(find.text('Confidence Score'), findsNothing);
|
|
expect(find.textContaining('rekomendasi otomatis'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('shows the selected SKU\'s product name as info text below the dropdown, not a form field', (tester) async {
|
|
await tester.pumpWidget(MaterialApp(
|
|
home: Scaffold(
|
|
body: ProductDropdownCard(
|
|
selectedSku: '1',
|
|
matches: matches,
|
|
hasAutoMatch: true,
|
|
onSkuChanged: (_) {},
|
|
),
|
|
),
|
|
));
|
|
|
|
expect(find.text('Produk A'), findsOneWidget);
|
|
// No PO-link field anymore (removed - user request).
|
|
expect(find.text('Hubungkan ke PO Dokumen'), findsNothing);
|
|
});
|
|
}
|