-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default, common use stubs #77
Comments
Hey @erickzanardo 👋 After some discussions, I think it would be best if we kept Also, for scenarios like the one you described it might be easier to forego using var onPressedCallCount = 0;
await tester.pumpWidget(
CustomButton(onPressed: () => onPressedCallCount++),
);
await tester.tap(...)
expect(onPressedCallCount, equals(1)); Let me know what you think and sorry for the delayed reply! |
Hey, thanks for the response. Yeah, the counter variable is something that I also used and it work perfectly, but this proposal makes it a little bit more convenient. A separate package sounds good too! Would that be something that could be kept under this mono repo? If so I would love to do a PR including it. Otherwise if you prefer to make it external, I could maintain it. |
Sorry for the delayed response! I'd prefer to create a separate package (maybe https://pub.dev/packages/mocktailx would accept a PR?). Let me know what you think 👍 |
Sounds good! I will work on this on a external package, thanks @felangel ! |
Mocktail could provide some default stub instances that are common use and not project specific.
A common one that I usually end up writing on every project is a VoidCallbackStub, usually to check if a onPressed callback was called on widget testing.
An implementation suggestion:
then we could use it like the following:
Is this something worth adding to Mocktail?
The text was updated successfully, but these errors were encountered: