diff --git a/packages/mocktail/CHANGELOG.md b/packages/mocktail/CHANGELOG.md index e67936a..cb5af84 100644 --- a/packages/mocktail/CHANGELOG.md +++ b/packages/mocktail/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.3.0-dev.1 + +- **BREAKING** feat: add support for type argument matching ([#66](https://github.com/felangel/mocktail/issues/66)) +- docs: minor snippet fixes in `README` ([#94](https://github.com/felangel/mocktail/pull/94)) +- docs: enhance example to illustrate more use cases + # 0.2.0 - **BREAKING** refactor: remove generic from `registerFallbackValue` diff --git a/packages/mocktail/README.md b/packages/mocktail/README.md index 05474c8..0fed955 100644 --- a/packages/mocktail/README.md +++ b/packages/mocktail/README.md @@ -177,7 +177,7 @@ Extension methods cannot be stubbed/verified as they are treated like static met Instead of stubbing/verifying extension methods directly, prefer to stub/verify public members on the instance with which the extension methods interact. -#### type 'Null' is not a subtype of type 'Future' +#### Why am I seeing error: type 'Null' is not a subtype of type 'Future'? [Relevant Issue](https://github.com/felangel/mocktail/issues/78) diff --git a/packages/mocktail/example/main.dart b/packages/mocktail/example/main.dart index d376a5e..adff22f 100644 --- a/packages/mocktail/example/main.dart +++ b/packages/mocktail/example/main.dart @@ -3,7 +3,9 @@ import 'package:test/test.dart'; class Food {} -class Fish extends Food {} +class Chicken extends Food {} + +class Tuna extends Food {} // A Real Cat class class Cat { @@ -16,14 +18,13 @@ class Cat { // A Mock Cat class class MockCat extends Mock implements Cat {} -// A Fake Fish class -class FakeFish extends Fish {} - void main() { group('Cat', () { setUpAll(() { - // Register fallback values when using `any` with custom types. - registerFallbackValue(FakeFish()); + // Register fallback values when using + // `any` or `captureAny` with custom objects. + registerFallbackValue(Chicken()); + registerFallbackValue(Tuna()); }); late Cat cat; @@ -52,10 +53,13 @@ void main() { verify(() => cat.likes('fish', isHungry: true)).called(1); // Interact with the mock. - cat.eat(Fish()); + cat + ..eat(Chicken()) + ..eat(Tuna()); // Verify the interaction with specific type arguments. - verify(() => cat.eat(any())).called(1); + verify(() => cat.eat(any())).called(1); + verify(() => cat.eat(any())).called(1); verifyNever(() => cat.eat(any())); }); }); diff --git a/packages/mocktail/example/pubspec.yaml b/packages/mocktail/example/pubspec.yaml index 142608f..c13b4f2 100644 --- a/packages/mocktail/example/pubspec.yaml +++ b/packages/mocktail/example/pubspec.yaml @@ -3,7 +3,7 @@ description: An example of mocktail usage publish_to: none environment: - sdk: ">=2.12-0-0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dev_dependencies: mocktail: diff --git a/packages/mocktail/pubspec.yaml b/packages/mocktail/pubspec.yaml index 45563ef..550df5b 100644 --- a/packages/mocktail/pubspec.yaml +++ b/packages/mocktail/pubspec.yaml @@ -1,6 +1,6 @@ name: mocktail description: A Dart mock library which simplifies mocking with null safety support and no manual mocks or code generation. -version: 0.2.0 +version: 0.3.0-dev.1 repository: https://github.com/felangel/mocktail homepage: https://github.com/felangel/mocktail/tree/main/packages/mocktail