mocktailx 0.0.3 icon indicating copy to clipboard operation
mocktailx: ^0.0.3 copied to clipboard

A set of utility functions over mocktail library created to increase productivity over daily mocking/testing.

mocktailx #

A set of utility functions for mocktail apis.

Usage #

First import mocktailx to your pubspec:

mocktailx: ^0.0.3  

Note that this library is a container for mocktail 0.3.0, so you don't need to import mocktail.
And don't forget to fix your imports:

import 'package:mocktailx/mocktailx.dart';  

Features #

thenAnswerWithVoid

// Instead of doing:  
when(repo.futureVoidFunction).thenAnswer((invocation) async {});  
// You can just:  
when(repo.futureVoidFunction).thenAnswerWithVoid();   

thenAnswerWith(T)

// Instead of doing:  
when(repo.futureIntFunction).thenAnswer((invocation) async => 10);  
// You can just:  
when(repo.futureIntFunction).thenAnswerWith(10);  

thenEmit(List)

// Instead of doing:  
when(repo.streamValue).thenAnswer((invocation) => Stream.fromIterable([1,2,3,4,5]));  
// You can just:  
when(repo.streamValue).thenEmit([1,2,3,4,5]);  

thenReturnWithVoid

// Instead of doing:  
when(repo.voidFunction).thenReturn(null);  
// You can just:  
when(repo.voidFunction).thenReturnWithVoid();   
7
likes
120
pub points
42%
popularity

Publisher

unverified uploader

A set of utility functions over mocktail library created to increase productivity over daily mocking/testing.

Homepage

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

Dependencies

mocktail

More

Packages that depend on mocktailx