Skip to content
pubscout

mocktailx

0.0.7, released 3 years ago by an unverified publisher

Utility functions for the mocktail library to increase productivity in tests.

WASM-ready
$ flutter pub add mocktailx
Source repository

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.

Works with

Packages commonly used together with mocktailx: ones it builds on, ones built on it, and its own family.