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());
  });

}

Libraries

mock_of_context
Mocks for the types provided in out_of_context