fix(test): corregge i fallimenti emersi alla prima esecuzione

- update_service_test: il fake HttpClientResponse tipizza lo stream
  come Stream<List<int>> (utf8.encode ritorna Uint8List)
- guide/info_bottom_sheet test: i titoli delle _DocCard sono resi
  con toUpperCase(), i finder ora cercano il testo maiuscolo
- converter_page_test e app_test: loadDb()/load() dei provider
  spostati nel setUp — chiamarli nel body di testWidgets (zona
  FakeAsync) bloccava la suite fino al timeout di 10 minuti

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 20:38:57 +02:00
parent d94bd5fdf7
commit 57f522e3a2
5 changed files with 31 additions and 15 deletions
@@ -15,10 +15,14 @@ const _riso =
ConversionEntry(food: 'riso', method: 'bollitura', yieldFactor: 3.0);
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
late ConverterProvider provider;
setUp(() {
// loadDb nel setUp (fuori dalla zona FakeAsync di testWidgets):
// caricarlo dentro il body del test può bloccare la suite.
setUp(() async {
provider = ConverterProvider();
await provider.loadDb();
});
group('ConverterPage — ricerca', () {
@@ -28,7 +32,6 @@ void main() {
});
testWidgets('la ricerca mostra risultati dal database', (tester) async {
await provider.loadDb();
await tester.pumpApp(_page(provider));
await tester.enterText(find.byType(TextField), 'riso');
await tester.pump();
@@ -37,7 +40,6 @@ void main() {
testWidgets('ricerca senza corrispondenze mostra "Nessun risultato"',
(tester) async {
await provider.loadDb();
await tester.pumpApp(_page(provider));
await tester.enterText(find.byType(TextField), 'xyzabc');
await tester.pump();
@@ -46,7 +48,6 @@ void main() {
testWidgets('tap su un risultato apre la card di conversione',
(tester) async {
await provider.loadDb();
await tester.pumpApp(_page(provider));
await tester.enterText(find.byType(TextField), 'riso');
await tester.pump();