mocktailx
0.0.7, released 3 years ago by an unverified publisher
Utility functions for the mocktail library to increase productivity in tests.
What it does
Adds extension methods to mocktail stubbing objects, allowing concise syntax for answers, returns, streams, and ordered mock sequences. It acts as a wrapper so mocktail does not need to be imported separately.
AI-written summary of version 0.0.7, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are already using mocktail for testing and want to reduce boilerplate when stubbing methods.
- You need to easily stub sequential return values or answers using thenReturnInOrder or thenAnswerInOrder.
Skip it when
- You do not use the mocktail library in your test suite.
- You prefer using standard mocktail syntax without additional wrappers.
Strengths
- Reduces boilerplate code for common stubbing patterns like void functions and streams.
- Provides convenient ordered return and answer sequences.
- Exports mocktail so you do not need to import both packages.
Weaknesses
- Dependent on the mocktail package and its version updates.
- Very narrow scope focused only on syntax sugar for mocktail.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add mocktailx to your dev_dependencies and import package:mocktailx/mocktailx.dart in your test files.
when(() => repo.addOne(any())).thenReturnInOrder([6, 7, 99]);Alternatives
Packages that do the same job and could replace mocktailx.
- analyzer_testing
Testing utilities and mocks for Dart analyzer and analysis server plugins.
79Compare - golden_screenshot
Utilities to automate screenshot generation using Flutter's golden tests.
76Compare - build_test
Utilities for unit testing Dart build_runner builders in memory
78Compare - flutter_hooks_test
Testing utilities for Flutter hooks that avoid writing wrapper widgets.
54Compare
Works with
Packages commonly used together with mocktailx: ones it builds on, ones built on it, and its own family.