mocktail

Create Mocktail-based test doubles for Dart and Flutter tests.

2|Updated Aug 13, 2023
One-click install
npx skills add https://github.com/NNPopov/movie-theater-tickets --skill mocktail-nnpopov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mocktail
Source: https://github.com/NNPopov/movie-theater-tickets/tree/main/src/clients/.claude/skills/mocktail
Command: npx skills add https://github.com/NNPopov/movie-theater-tickets --skill mocktail-nnpopov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Mocktail makes it easier to isolate Dart and Flutter code in tests when you need controllable stand-ins for services, repositories, events, or other collaborators. It helps you choose between real objects, lightweight fakes, and verifiable mocks without relying on code generation.

Core Features & Use Cases

  • Mock, fake, or real guidance: Pick the simplest test double that fits your scenario.
  • Fallback values and argument matching: Register custom placeholders so matchers can work with non-nullable types.
  • Stubbing and verification: Define return values, async answers, errors, and interaction checks for the calls that matter.
  • Use case: When testing a booking flow, mock the payment gateway, fake simple domain objects, and verify that the reservation service was called with the expected seat data.

Quick Start

Use the mocktail skill to create the needed test double, register any custom fallback values, stub the expected calls, and verify the interactions in your Dart or Flutter test.

Frequently Asked Questions about mocktail

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I mock a Dart class for Flutter testing without code generation?

Mocking Dart classes for Flutter testing without code generation requires creating noSuchMethod-based mock classes, allowing you to isolate services and repositories using explicit stubs instead of build runners.

When should I use a mock vs a fake object in Dart tests?

Choosing between a mock and a fake object in Dart tests depends on your goal: use verifiable mocks to check interactions and call arguments, and lightweight fakes for simple domain objects or scenarios needing controllable stand-ins.

Why do I need to register fallback values for custom matchers in Dart tests?

Registering fallback values for custom matchers in Dart tests is necessary so argument matchers can work with non-nullable types, providing the placeholders required when stubbing calls that involve custom parameter types.

How do I stub async calls and verify interactions in a Dart booking flow?

Stubbing async calls and verifying interactions in a Dart booking flow involves defining return values, setting async answers, and checking that the reservation service was called with the expected seat data.

Can I use argument matching with named parameters in Flutter tests?

Argument matching with named parameters in Flutter tests is fully supported, allowing you to specify expected calls, register fallback values for custom types, and verify interactions accurately.

What is the best way to isolate external services in Dart and Flutter tests?

The best way to isolate external services in Dart and Flutter tests is to use mocktail-based test doubles, picking the simplest stand-in that fits your scenario to control service behavior and verify interactions.