mocktail could offer string diffs on call failures?
For long strings it can be very hard to figure out how to match calls exactly. e.g.:
verify(
() => logger.info('''
Your next step is to upload the app bundle to the Play Store:
build/app/outputs/bundle/release/app-release.aab
Or distribute the apk:
build/app/outputs/apk/release/app-release.apk
For information on uploading to the Play Store, see:
${link(uri: Uri.parse('https://support.google.com/googleplay/android-developer/answer/9859152?hl=en'))}
'''),
I get the message:
00:01 +304 ~1 -1: test/src/commands/release/release_android_command_test.dart: ReleaseAndroidCommand succeeds when release is successful (with apk) [E]
No matching calls. All calls: _MockLogger.progress(Building release, {options: null}),
_MockLogger.progress(Detecting release version, {options: null}),
_MockLogger.info(
🚀 Ready to create a new release!
📱 App: Test App (test-app-id)
📦 Release Version: 1.2.3+1
🕹️ Platform: android (arm64, arm32, x86_64)
, {style: null}),
_MockLogger.confirm(Would you like to continue?, {defaultValue: false}),
[VERIFIED] _MockLogger.success(
✅ Published Release!, {style: null}),
_MockLogger.info(
Your next step is to upload the app bundle to the Play Store:
build/app/outputs/bundle/release/app-release.aab
Or distribute the apk:
build/app/outputs/apk/release/app-release.apk
For information on uploading to the Play Store, see:
https://support.google.com/googleplay/android-developer/answer/9859152?hl=en
, {style: null})
(If you called `verify(...).called(0);`, please instead use `verifyNever(...);`.)
package:matcher fail
package:mocktail/src/mocktail.dart 728:7 _VerifyCall._checkWith
package:mocktail/src/mocktail.dart 519:18 _makeVerify.<fn>
test/src/commands/release/release_android_command_test.dart 374:13 main.<fn>.<fn>
I'm clearly very close, but not quite right yet. Mocktail could theoretically detect this and offer me a string difference to help see where my error is. 🤷 That may be out of scope for mocktail though.
package:test has some decent string diffing code (I even used it in a recent fun project): https://github.com/dart-lang/test/blob/2cb07a3f4d16b74f1181bd8f963d342db5a8e6b0/pkgs/checks/lib/src/extensions/string.dart
Turns out it was just me missing a "lightCyan.wrap" around my apk/aab paths in the above. 🤷
The matcher "equals" has some nice string diff outputs (as well as for collections). Mocktail could it use its "describeMismatch" for this