he following TestFailure was thrown running a test:
Expected: <1> Actual: <0> Unexpected number of calls
void main() {
testWidgets('Shold transfer to a contact', (tester) async {
final mockContactDao = MocKContactDao();
await tester.pumpWidget(Bytebank(contactDao: mockContactDao));
when(mockContactDao.findAll()).thenAnswer((invocation) async {
//debugPrint('name invocation ${invocation.memberName}');
return [Contact(0, 'full time', 7000)];
});
await clickOnTheTransferFeatureItem (tester);
await tester.pumpAndSettle();
final dashboard = find.byType(Dashboard);
expect(dashboard, findsOneWidget);
await clickOnTheTransferFeatureItem(tester);
for (int i = 0; i < 5; i++) {
await tester.pump(Duration(seconds: 1));
}
//await tester.pumpAndSettle();
final contactsList = find.byType(ContactsList);
//expect(contactsList, findsOneWidget);
expect(find.text('Transfer', skipOffstage: false), findsNWidgets(1));
verifyNever(mockContactDao.findAll()).called(1);
final contactItem = find.byWidgetPredicate((widget) {
if(widget is ContactItem) {
return widget.contact.name == 'full time' && widget.contact.accountNumber == 7000;
}
return false;
});
expect(contactItem, findsOneWidget);
await tester.tap(contactItem);
await tester.pumpAndSettle();
final transactionForm = find.byType(TransactionForm);
expect(transactionForm, findsOneWidget);
});
}
clickOnTheTransferFeatureItem(WidgetTester tester) {}