felangel / felangel/mocktail

mocktail could offer string diffs on call failures?

Đang mở
#208 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Dart
Star
702
Fork
88
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

For long strings it can be very hard to figure out how to match calls exactly. e.g.:
```dart
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.
test/src/commands/release/release_android_command_test.dart 374:13 main..
```

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.