test(block2): stop market discover tests hanging on the searching spinner

The 'searching' state shows a CircularProgressIndicator, so pumpAndSettle never
settled and the widget test hung ~10 min. Pump a couple of fixed frames instead
(the buffered offers deliver on a microtask), and close the fake discover stream
so it's finite. Reported by the user.
This commit is contained in:
vjrj 2026-07-10 12:06:19 +02:00
parent aa457ab91a
commit eed7c70037

View file

@ -39,6 +39,7 @@ class FakeOfferTransport implements OfferTransport {
for (final o in offers) { for (final o in offers) {
if (o.approxGeohash.startsWith(query.geohashPrefix)) c.add(o); if (o.approxGeohash.startsWith(query.geohashPrefix)) c.add(o);
} }
unawaited(c.close()); // finite: deliver buffered matches, then done
return c.stream; return c.stream;
} }
@ -91,7 +92,10 @@ void main() {
])); ]));
await tester.pumpWidget(_wrapBody(cubit, selfPubkey: me)); await tester.pumpWidget(_wrapBody(cubit, selfPubkey: me));
await cubit.discover('sp3'); await cubit.discover('sp3');
await tester.pumpAndSettle(); // Pump a couple of frames (NOT pumpAndSettle the brief "searching" spinner
// never settles). The buffered offers deliver on a microtask.
await tester.pump();
await tester.pump();
expect(find.text('You'), findsOneWidget); expect(find.text('You'), findsOneWidget);
// My own listing offers no "Message yourself" button. // My own listing offers no "Message yourself" button.
@ -108,7 +112,10 @@ void main() {
await tester.pumpWidget(_wrapBody(cubit)); await tester.pumpWidget(_wrapBody(cubit));
await cubit.discover('sp3'); await cubit.discover('sp3');
await tester.pumpAndSettle(); // Pump a couple of frames (NOT pumpAndSettle the brief "searching" spinner
// never settles). The buffered offers deliver on a microtask.
await tester.pump();
await tester.pump();
expect(find.text('Tomate rosa de Barbastro'), findsOneWidget); expect(find.text('Tomate rosa de Barbastro'), findsOneWidget);
expect(find.text('Judía del ganxet'), findsOneWidget); expect(find.text('Judía del ganxet'), findsOneWidget);