0 purchases
dart class wrapper
Dart Class Wrapper #
Wrapper for a simplified partial mocking in Unit Tests.
Getting started #
Initialization
// Support a list of classes
@GenerateWithMethodSetters([AppData])
import 'file_test_name.wrapper.dart';
void main() {
group('Validate ....', () {
setUp(() => mock = WrapperAppData());
test('If ... Then ...', () {
// Original method `getStateDelta`
mock.mockGetStateDelta = (a, b) => 123.0;
// ....
});
});
}
copied to clipboard
Execution
# Cleanup autogenerated files
dart run build_runner clean
# Generate wrappers
dart run build_runner build --delete-conflicting-outputs
# Run tests
flutter test
copied to clipboard
In addition to thanking, you may treat us to ☕.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.