Skip to content

Commit

Permalink
chore(mocktail): v0.3.0-dev.1 (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel authored Dec 20, 2021
1 parent 6db5916 commit ed5aa6a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
6 changes: 6 additions & 0 deletions packages/mocktail/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 1 addition & 1 deletion packages/mocktail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>'
#### Why am I seeing error: type 'Null' is not a subtype of type 'Future<void>'?

[Relevant Issue](https://github.com/felangel/mocktail/issues/78)

Expand Down
20 changes: 12 additions & 8 deletions packages/mocktail/example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down Expand Up @@ -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<Fish>(any())).called(1);
verify(() => cat.eat<Chicken>(any())).called(1);
verify(() => cat.eat<Tuna>(any())).called(1);
verifyNever(() => cat.eat<Food>(any()));
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/mocktail/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion packages/mocktail/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit ed5aa6a

Please sign in to comment.