mock_of_context 1.2.0

Flutter Android iOS web

Mock of Context is a companion project for testing Out of Context.

Mock of Context - Companion project for Out Of Context #

Mock of Context Build Codecov Pub Dev Documentation

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.2.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 DispatcherMixin {

  void back() => dispatcher.pop();

}

class StubFancy extends Fancy with MockDispatcherMixin {}

void main() {
  
  test('example', () {
    final fancy = StubFancy()..pop();
    verify(fancy.dispatcher.pop());
  });

}
0
likes
110
pub points
0%
popularity

Publisher

foruslabs.com

Mock of Context is a companion project for testing Out of Context.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, meta, mockito, out_of_context

More

Packages that depend on mock_of_context