Skip to content

Commit

Permalink
Migrate flutter_dispose_scope to mocktail
Browse files Browse the repository at this point in the history
  • Loading branch information
shilangyu committed Jun 10, 2023
1 parent e6eaa25 commit c3d9968
Show file tree
Hide file tree
Showing 26 changed files with 45 additions and 585 deletions.
3 changes: 1 addition & 2 deletions packages/flutter_dispose_scope/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ dependencies:
meta: ^1.3.0

dev_dependencies:
build_runner: ^2.0.3
flutter_test:
sdk: flutter
lint: ^1.5.3
mockito: ^5.0.8
mocktail: ^0.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import 'package:dispose_scope/src/dispose_scope.dart';
import 'package:flutter/animation.dart';
import 'package:flutter_dispose_scope/src/disposed_extensions/animation_eager_listener_mixin_disposed.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:mocktail/mocktail.dart';

import 'animation_eager_listener_mixin_disposed_test.mocks.dart';
class MockAnimationEagerListenerMixin extends Mock
implements AnimationEagerListenerMixin {}

@GenerateMocks([AnimationEagerListenerMixin])
void main() {
group(
'AnimationEagerListenerMixinDisposed',
Expand All @@ -29,7 +28,7 @@ void main() {

await scope.dispose();

verify(animationEagerListenerMixin.dispose()).called(1);
verify(() => animationEagerListenerMixin.dispose()).called(1);
},
);
},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import 'package:dispose_scope/src/dispose_scope.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_dispose_scope/src/disposed_extensions/box_painter_disposed.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:mocktail/mocktail.dart';

import 'box_painter_disposed_test.mocks.dart';
class MockBoxPainter extends Mock implements BoxPainter {}

@GenerateMocks([BoxPainter])
void main() {
group(
'BoxPainterDisposed',
Expand All @@ -29,7 +27,7 @@ void main() {

await scope.dispose();

verify(boxPainter.dispose()).called(1);
verify(() => boxPainter.dispose()).called(1);
},
);
},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import 'package:dispose_scope/src/dispose_scope.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_dispose_scope/src/disposed_extensions/change_notifier_disposed.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:mocktail/mocktail.dart';

import 'change_notifier_disposed_test.mocks.dart';
class MockChangeNotifier extends Mock implements ChangeNotifier {}

@GenerateMocks([ChangeNotifier])
void main() {
group(
'ChangeNotifierDisposed',
Expand All @@ -29,7 +27,7 @@ void main() {

await scope.dispose();

verify(changeNotifier.dispose()).called(1);
verify(() => changeNotifier.dispose()).called(1);
},
);
},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import 'package:dispose_scope/src/dispose_scope.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_dispose_scope/src/disposed_extensions/decoration_image_painter_disposed.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:mocktail/mocktail.dart';

import 'decoration_image_painter_disposed_test.mocks.dart';
class MockDecorationImagePainter extends Mock
implements DecorationImagePainter {}

@GenerateMocks([DecorationImagePainter])
void main() {
group(
'DecorationImagePainterDisposed',
Expand All @@ -29,7 +28,7 @@ void main() {

await scope.dispose();

verify(decorationImagePainter.dispose()).called(1);
verify(() => decorationImagePainter.dispose()).called(1);
},
);
},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import 'package:dispose_scope/src/dispose_scope.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_dispose_scope/src/disposed_extensions/disposable_build_context_disposed.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:mocktail/mocktail.dart';

import 'disposable_build_context_disposed_test.mocks.dart';
class MockDisposableBuildContext extends Mock
implements DisposableBuildContext {}

@GenerateMocks([DisposableBuildContext])
void main() {
group(
'DisposableBuildContextDisposed',
Expand All @@ -29,7 +28,7 @@ void main() {

await scope.dispose();

verify(disposableBuildContext.dispose()).called(1);
verify(() => disposableBuildContext.dispose()).called(1);
},
);
},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_dispose_scope/src/disposed_extensions/gesture_recognizer_disposed.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:mocktail/mocktail.dart';

class MockGestureRecognizer extends Mock implements GestureRecognizer {
@override
Expand Down Expand Up @@ -31,7 +31,7 @@ void main() {

await scope.dispose();

verify(gestureRecognizer.dispose()).called(1);
verify(() => gestureRecognizer.dispose()).called(1);
},
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import 'package:dispose_scope/src/dispose_scope.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_dispose_scope/src/disposed_extensions/image_info_disposed.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:mocktail/mocktail.dart';

import 'image_info_disposed_test.mocks.dart';
// ignore: avoid_implementing_value_types
class MockImageInfo extends Mock implements ImageInfo {}

@GenerateMocks([ImageInfo])
void main() {
group(
'ImageInfoDisposed',
Expand All @@ -29,7 +28,7 @@ void main() {

await scope.dispose();

verify(imageInfo.dispose()).called(1);
verify(() => imageInfo.dispose()).called(1);
},
);
},
Expand Down
Loading

0 comments on commit c3d9968

Please sign in to comment.