mock_of_context 1.1.0
mock_of_context: ^1.1.0 copied to clipboard
Mock of Context is a companion project for testing Out of Context.
Mock of Context - Companion project for Out Of Context #
Please view the stable brunch for a production version.
Using mock_of_context #
To import the library, add the following dependency to your project.
dev_dependencies:
mock_of_context: ^1.1.0
Then, use any of the Mixins provided to mock a mixin from Out of Context.
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:mock_of_context/mock_of_context.dart';
import 'package:out_of_context/out_of_context.dart';
class Fancy with RouterMixin {
void back() => router.pop();
}
class StubFancy extends Fancy with MockRouterMixin {}
void main() {
test('example', () {
final fancy = StubFancy()..pop();
verify(fancy.router.pop());
});
}