feat: Initialize project
This commit is contained in:
78
test/helpers/test_helpers.dart
Normal file
78
test/helpers/test_helpers.dart
Normal file
@@ -0,0 +1,78 @@
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:bahla_front/app/app.locator.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
// @stacked-import
|
||||
|
||||
import 'test_helpers.mocks.dart';
|
||||
|
||||
@GenerateMocks([], customMocks: [
|
||||
MockSpec<NavigationService>(onMissingStub: OnMissingStub.returnDefault),
|
||||
MockSpec<BottomSheetService>(onMissingStub: OnMissingStub.returnDefault),
|
||||
MockSpec<DialogService>(onMissingStub: OnMissingStub.returnDefault),
|
||||
// @stacked-mock-spec
|
||||
])
|
||||
void registerServices() {
|
||||
getAndRegisterNavigationService();
|
||||
getAndRegisterBottomSheetService();
|
||||
getAndRegisterDialogService();
|
||||
// @stacked-mock-register
|
||||
}
|
||||
|
||||
MockNavigationService getAndRegisterNavigationService() {
|
||||
_removeRegistrationIfExists<NavigationService>();
|
||||
final service = MockNavigationService();
|
||||
locator.registerSingleton<NavigationService>(service);
|
||||
return service;
|
||||
}
|
||||
|
||||
MockBottomSheetService getAndRegisterBottomSheetService<T>({
|
||||
SheetResponse<T>? showCustomSheetResponse,
|
||||
}) {
|
||||
_removeRegistrationIfExists<BottomSheetService>();
|
||||
final service = MockBottomSheetService();
|
||||
|
||||
when(service.showCustomSheet<T, T>(
|
||||
enableDrag: anyNamed('enableDrag'),
|
||||
enterBottomSheetDuration: anyNamed('enterBottomSheetDuration'),
|
||||
exitBottomSheetDuration: anyNamed('exitBottomSheetDuration'),
|
||||
ignoreSafeArea: anyNamed('ignoreSafeArea'),
|
||||
isScrollControlled: anyNamed('isScrollControlled'),
|
||||
barrierDismissible: anyNamed('barrierDismissible'),
|
||||
additionalButtonTitle: anyNamed('additionalButtonTitle'),
|
||||
variant: anyNamed('variant'),
|
||||
title: anyNamed('title'),
|
||||
hasImage: anyNamed('hasImage'),
|
||||
imageUrl: anyNamed('imageUrl'),
|
||||
showIconInMainButton: anyNamed('showIconInMainButton'),
|
||||
mainButtonTitle: anyNamed('mainButtonTitle'),
|
||||
showIconInSecondaryButton: anyNamed('showIconInSecondaryButton'),
|
||||
secondaryButtonTitle: anyNamed('secondaryButtonTitle'),
|
||||
showIconInAdditionalButton: anyNamed('showIconInAdditionalButton'),
|
||||
takesInput: anyNamed('takesInput'),
|
||||
barrierColor: anyNamed('barrierColor'),
|
||||
barrierLabel: anyNamed('barrierLabel'),
|
||||
customData: anyNamed('customData'),
|
||||
data: anyNamed('data'),
|
||||
description: anyNamed('description'),
|
||||
)).thenAnswer((realInvocation) =>
|
||||
Future.value(showCustomSheetResponse ?? SheetResponse<T>()));
|
||||
|
||||
locator.registerSingleton<BottomSheetService>(service);
|
||||
return service;
|
||||
}
|
||||
|
||||
MockDialogService getAndRegisterDialogService() {
|
||||
_removeRegistrationIfExists<DialogService>();
|
||||
final service = MockDialogService();
|
||||
locator.registerSingleton<DialogService>(service);
|
||||
return service;
|
||||
}
|
||||
|
||||
// @stacked-mock-create
|
||||
|
||||
void _removeRegistrationIfExists<T extends Object>() {
|
||||
if (locator.isRegistered<T>()) {
|
||||
locator.unregister<T>();
|
||||
}
|
||||
}
|
||||
672
test/helpers/test_helpers.mocks.dart
Normal file
672
test/helpers/test_helpers.mocks.dart
Normal file
@@ -0,0 +1,672 @@
|
||||
// Mocks generated by Mockito 5.4.4 from annotations
|
||||
// in bahla_front/test/helpers/test_helpers.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i5;
|
||||
import 'dart:ui' as _i6;
|
||||
|
||||
import 'package:flutter/material.dart' as _i4;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:mockito/src/dummies.dart' as _i3;
|
||||
import 'package:stacked_services/stacked_services.dart' as _i2;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
// ignore_for_file: avoid_setters_without_getters
|
||||
// ignore_for_file: comment_references
|
||||
// ignore_for_file: deprecated_member_use
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
/// A class which mocks [NavigationService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNavigationService extends _i1.Mock implements _i2.NavigationService {
|
||||
@override
|
||||
String get previousRoute => (super.noSuchMethod(
|
||||
Invocation.getter(#previousRoute),
|
||||
returnValue: _i3.dummyValue<String>(
|
||||
this,
|
||||
Invocation.getter(#previousRoute),
|
||||
),
|
||||
returnValueForMissingStub: _i3.dummyValue<String>(
|
||||
this,
|
||||
Invocation.getter(#previousRoute),
|
||||
),
|
||||
) as String);
|
||||
|
||||
@override
|
||||
String get currentRoute => (super.noSuchMethod(
|
||||
Invocation.getter(#currentRoute),
|
||||
returnValue: _i3.dummyValue<String>(
|
||||
this,
|
||||
Invocation.getter(#currentRoute),
|
||||
),
|
||||
returnValueForMissingStub: _i3.dummyValue<String>(
|
||||
this,
|
||||
Invocation.getter(#currentRoute),
|
||||
),
|
||||
) as String);
|
||||
|
||||
@override
|
||||
_i4.GlobalKey<_i4.NavigatorState>? nestedNavigationKey(int? index) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#nestedNavigationKey,
|
||||
[index],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i4.GlobalKey<_i4.NavigatorState>?);
|
||||
|
||||
@override
|
||||
void config({
|
||||
bool? enableLog,
|
||||
bool? defaultPopGesture,
|
||||
bool? defaultOpaqueRoute,
|
||||
Duration? defaultDurationTransition,
|
||||
bool? defaultGlobalState,
|
||||
_i2.Transition? defaultTransitionStyle,
|
||||
String? defaultTransition,
|
||||
}) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#config,
|
||||
[],
|
||||
{
|
||||
#enableLog: enableLog,
|
||||
#defaultPopGesture: defaultPopGesture,
|
||||
#defaultOpaqueRoute: defaultOpaqueRoute,
|
||||
#defaultDurationTransition: defaultDurationTransition,
|
||||
#defaultGlobalState: defaultGlobalState,
|
||||
#defaultTransitionStyle: defaultTransitionStyle,
|
||||
#defaultTransition: defaultTransition,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? navigateWithTransition<T>(
|
||||
_i4.Widget? page, {
|
||||
bool? opaque,
|
||||
String? transition = r'',
|
||||
Duration? duration,
|
||||
bool? popGesture,
|
||||
int? id,
|
||||
_i4.Curve? curve,
|
||||
bool? fullscreenDialog = false,
|
||||
bool? preventDuplicates = true,
|
||||
_i2.Transition? transitionClass,
|
||||
_i2.Transition? transitionStyle,
|
||||
String? routeName,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#navigateWithTransition,
|
||||
[page],
|
||||
{
|
||||
#opaque: opaque,
|
||||
#transition: transition,
|
||||
#duration: duration,
|
||||
#popGesture: popGesture,
|
||||
#id: id,
|
||||
#curve: curve,
|
||||
#fullscreenDialog: fullscreenDialog,
|
||||
#preventDuplicates: preventDuplicates,
|
||||
#transitionClass: transitionClass,
|
||||
#transitionStyle: transitionStyle,
|
||||
#routeName: routeName,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? replaceWithTransition<T>(
|
||||
_i4.Widget? page, {
|
||||
bool? opaque,
|
||||
String? transition = r'',
|
||||
Duration? duration,
|
||||
bool? popGesture,
|
||||
int? id,
|
||||
_i4.Curve? curve,
|
||||
bool? fullscreenDialog = false,
|
||||
bool? preventDuplicates = true,
|
||||
_i2.Transition? transitionClass,
|
||||
_i2.Transition? transitionStyle,
|
||||
String? routeName,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#replaceWithTransition,
|
||||
[page],
|
||||
{
|
||||
#opaque: opaque,
|
||||
#transition: transition,
|
||||
#duration: duration,
|
||||
#popGesture: popGesture,
|
||||
#id: id,
|
||||
#curve: curve,
|
||||
#fullscreenDialog: fullscreenDialog,
|
||||
#preventDuplicates: preventDuplicates,
|
||||
#transitionClass: transitionClass,
|
||||
#transitionStyle: transitionStyle,
|
||||
#routeName: routeName,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
bool back<T>({
|
||||
dynamic result,
|
||||
int? id,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#back,
|
||||
[],
|
||||
{
|
||||
#result: result,
|
||||
#id: id,
|
||||
},
|
||||
),
|
||||
returnValue: false,
|
||||
returnValueForMissingStub: false,
|
||||
) as bool);
|
||||
|
||||
@override
|
||||
void popUntil(
|
||||
_i4.RoutePredicate? predicate, {
|
||||
int? id,
|
||||
}) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#popUntil,
|
||||
[predicate],
|
||||
{#id: id},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void popRepeated(int? popTimes) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#popRepeated,
|
||||
[popTimes],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? navigateTo<T>(
|
||||
String? routeName, {
|
||||
dynamic arguments,
|
||||
int? id,
|
||||
bool? preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
_i4.RouteTransitionsBuilder? transition,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#navigateTo,
|
||||
[routeName],
|
||||
{
|
||||
#arguments: arguments,
|
||||
#id: id,
|
||||
#preventDuplicates: preventDuplicates,
|
||||
#parameters: parameters,
|
||||
#transition: transition,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? navigateToView<T>(
|
||||
_i4.Widget? view, {
|
||||
dynamic arguments,
|
||||
int? id,
|
||||
bool? opaque,
|
||||
_i4.Curve? curve,
|
||||
Duration? duration,
|
||||
bool? fullscreenDialog = false,
|
||||
bool? popGesture,
|
||||
bool? preventDuplicates = true,
|
||||
_i2.Transition? transition,
|
||||
_i2.Transition? transitionStyle,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#navigateToView,
|
||||
[view],
|
||||
{
|
||||
#arguments: arguments,
|
||||
#id: id,
|
||||
#opaque: opaque,
|
||||
#curve: curve,
|
||||
#duration: duration,
|
||||
#fullscreenDialog: fullscreenDialog,
|
||||
#popGesture: popGesture,
|
||||
#preventDuplicates: preventDuplicates,
|
||||
#transition: transition,
|
||||
#transitionStyle: transitionStyle,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? replaceWith<T>(
|
||||
String? routeName, {
|
||||
dynamic arguments,
|
||||
int? id,
|
||||
bool? preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
_i4.RouteTransitionsBuilder? transition,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#replaceWith,
|
||||
[routeName],
|
||||
{
|
||||
#arguments: arguments,
|
||||
#id: id,
|
||||
#preventDuplicates: preventDuplicates,
|
||||
#parameters: parameters,
|
||||
#transition: transition,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? clearStackAndShow<T>(
|
||||
String? routeName, {
|
||||
dynamic arguments,
|
||||
int? id,
|
||||
Map<String, String>? parameters,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#clearStackAndShow,
|
||||
[routeName],
|
||||
{
|
||||
#arguments: arguments,
|
||||
#id: id,
|
||||
#parameters: parameters,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? clearStackAndShowView<T>(
|
||||
_i4.Widget? view, {
|
||||
dynamic arguments,
|
||||
int? id,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#clearStackAndShowView,
|
||||
[view],
|
||||
{
|
||||
#arguments: arguments,
|
||||
#id: id,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? clearTillFirstAndShow<T>(
|
||||
String? routeName, {
|
||||
dynamic arguments,
|
||||
int? id,
|
||||
bool? preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#clearTillFirstAndShow,
|
||||
[routeName],
|
||||
{
|
||||
#arguments: arguments,
|
||||
#id: id,
|
||||
#preventDuplicates: preventDuplicates,
|
||||
#parameters: parameters,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? clearTillFirstAndShowView<T>(
|
||||
_i4.Widget? view, {
|
||||
dynamic arguments,
|
||||
int? id,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#clearTillFirstAndShowView,
|
||||
[view],
|
||||
{
|
||||
#arguments: arguments,
|
||||
#id: id,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
|
||||
@override
|
||||
_i5.Future<T?>? pushNamedAndRemoveUntil<T>(
|
||||
String? routeName, {
|
||||
_i4.RoutePredicate? predicate,
|
||||
dynamic arguments,
|
||||
int? id,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#pushNamedAndRemoveUntil,
|
||||
[routeName],
|
||||
{
|
||||
#predicate: predicate,
|
||||
#arguments: arguments,
|
||||
#id: id,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
) as _i5.Future<T?>?);
|
||||
}
|
||||
|
||||
/// A class which mocks [BottomSheetService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockBottomSheetService extends _i1.Mock
|
||||
implements _i2.BottomSheetService {
|
||||
@override
|
||||
void setCustomSheetBuilders(Map<dynamic, _i2.SheetBuilder>? builders) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setCustomSheetBuilders,
|
||||
[builders],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.SheetResponse<dynamic>?> showBottomSheet({
|
||||
required String? title,
|
||||
String? description,
|
||||
String? confirmButtonTitle = r'Ok',
|
||||
String? cancelButtonTitle,
|
||||
bool? enableDrag = true,
|
||||
bool? barrierDismissible = true,
|
||||
bool? isScrollControlled = false,
|
||||
Duration? exitBottomSheetDuration,
|
||||
Duration? enterBottomSheetDuration,
|
||||
bool? ignoreSafeArea,
|
||||
bool? useRootNavigator = false,
|
||||
double? elevation = 1.0,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#showBottomSheet,
|
||||
[],
|
||||
{
|
||||
#title: title,
|
||||
#description: description,
|
||||
#confirmButtonTitle: confirmButtonTitle,
|
||||
#cancelButtonTitle: cancelButtonTitle,
|
||||
#enableDrag: enableDrag,
|
||||
#barrierDismissible: barrierDismissible,
|
||||
#isScrollControlled: isScrollControlled,
|
||||
#exitBottomSheetDuration: exitBottomSheetDuration,
|
||||
#enterBottomSheetDuration: enterBottomSheetDuration,
|
||||
#ignoreSafeArea: ignoreSafeArea,
|
||||
#useRootNavigator: useRootNavigator,
|
||||
#elevation: elevation,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.SheetResponse<dynamic>?>.value(),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i2.SheetResponse<dynamic>?>.value(),
|
||||
) as _i5.Future<_i2.SheetResponse<dynamic>?>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.SheetResponse<T>?> showCustomSheet<T, R>({
|
||||
dynamic variant,
|
||||
String? title,
|
||||
String? description,
|
||||
bool? hasImage = false,
|
||||
String? imageUrl,
|
||||
bool? showIconInMainButton = false,
|
||||
String? mainButtonTitle,
|
||||
bool? showIconInSecondaryButton = false,
|
||||
String? secondaryButtonTitle,
|
||||
bool? showIconInAdditionalButton = false,
|
||||
String? additionalButtonTitle,
|
||||
bool? takesInput = false,
|
||||
_i6.Color? barrierColor = const _i6.Color(2315255808),
|
||||
double? elevation = 1.0,
|
||||
bool? barrierDismissible = true,
|
||||
bool? isScrollControlled = false,
|
||||
String? barrierLabel = r'',
|
||||
dynamic customData,
|
||||
R? data,
|
||||
bool? enableDrag = true,
|
||||
Duration? exitBottomSheetDuration,
|
||||
Duration? enterBottomSheetDuration,
|
||||
bool? ignoreSafeArea,
|
||||
bool? useRootNavigator = false,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#showCustomSheet,
|
||||
[],
|
||||
{
|
||||
#variant: variant,
|
||||
#title: title,
|
||||
#description: description,
|
||||
#hasImage: hasImage,
|
||||
#imageUrl: imageUrl,
|
||||
#showIconInMainButton: showIconInMainButton,
|
||||
#mainButtonTitle: mainButtonTitle,
|
||||
#showIconInSecondaryButton: showIconInSecondaryButton,
|
||||
#secondaryButtonTitle: secondaryButtonTitle,
|
||||
#showIconInAdditionalButton: showIconInAdditionalButton,
|
||||
#additionalButtonTitle: additionalButtonTitle,
|
||||
#takesInput: takesInput,
|
||||
#barrierColor: barrierColor,
|
||||
#elevation: elevation,
|
||||
#barrierDismissible: barrierDismissible,
|
||||
#isScrollControlled: isScrollControlled,
|
||||
#barrierLabel: barrierLabel,
|
||||
#customData: customData,
|
||||
#data: data,
|
||||
#enableDrag: enableDrag,
|
||||
#exitBottomSheetDuration: exitBottomSheetDuration,
|
||||
#enterBottomSheetDuration: enterBottomSheetDuration,
|
||||
#ignoreSafeArea: ignoreSafeArea,
|
||||
#useRootNavigator: useRootNavigator,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.SheetResponse<T>?>.value(),
|
||||
returnValueForMissingStub: _i5.Future<_i2.SheetResponse<T>?>.value(),
|
||||
) as _i5.Future<_i2.SheetResponse<T>?>);
|
||||
|
||||
@override
|
||||
void completeSheet(_i2.SheetResponse<dynamic>? response) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#completeSheet,
|
||||
[response],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
}
|
||||
|
||||
/// A class which mocks [DialogService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockDialogService extends _i1.Mock implements _i2.DialogService {
|
||||
@override
|
||||
void registerCustomDialogBuilders(
|
||||
Map<dynamic, _i2.DialogBuilder>? builders) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#registerCustomDialogBuilders,
|
||||
[builders],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void registerCustomDialogBuilder({
|
||||
required dynamic variant,
|
||||
required _i4.Widget Function(
|
||||
_i4.BuildContext,
|
||||
_i2.DialogRequest<dynamic>,
|
||||
dynamic Function(_i2.DialogResponse<dynamic>),
|
||||
)? builder,
|
||||
}) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#registerCustomDialogBuilder,
|
||||
[],
|
||||
{
|
||||
#variant: variant,
|
||||
#builder: builder,
|
||||
},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.DialogResponse<dynamic>?> showDialog({
|
||||
String? title,
|
||||
String? description,
|
||||
String? cancelTitle,
|
||||
_i6.Color? cancelTitleColor,
|
||||
String? buttonTitle = r'Ok',
|
||||
_i6.Color? buttonTitleColor,
|
||||
bool? barrierDismissible = false,
|
||||
_i2.DialogPlatform? dialogPlatform,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#showDialog,
|
||||
[],
|
||||
{
|
||||
#title: title,
|
||||
#description: description,
|
||||
#cancelTitle: cancelTitle,
|
||||
#cancelTitleColor: cancelTitleColor,
|
||||
#buttonTitle: buttonTitle,
|
||||
#buttonTitleColor: buttonTitleColor,
|
||||
#barrierDismissible: barrierDismissible,
|
||||
#dialogPlatform: dialogPlatform,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.DialogResponse<dynamic>?>.value(),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i2.DialogResponse<dynamic>?>.value(),
|
||||
) as _i5.Future<_i2.DialogResponse<dynamic>?>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.DialogResponse<T>?> showCustomDialog<T, R>({
|
||||
dynamic variant,
|
||||
String? title,
|
||||
String? description,
|
||||
bool? hasImage = false,
|
||||
String? imageUrl,
|
||||
bool? showIconInMainButton = false,
|
||||
String? mainButtonTitle,
|
||||
bool? showIconInSecondaryButton = false,
|
||||
String? secondaryButtonTitle,
|
||||
bool? showIconInAdditionalButton = false,
|
||||
String? additionalButtonTitle,
|
||||
bool? takesInput = false,
|
||||
_i6.Color? barrierColor = const _i6.Color(2315255808),
|
||||
bool? barrierDismissible = false,
|
||||
String? barrierLabel = r'',
|
||||
bool? useSafeArea = true,
|
||||
dynamic customData,
|
||||
R? data,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#showCustomDialog,
|
||||
[],
|
||||
{
|
||||
#variant: variant,
|
||||
#title: title,
|
||||
#description: description,
|
||||
#hasImage: hasImage,
|
||||
#imageUrl: imageUrl,
|
||||
#showIconInMainButton: showIconInMainButton,
|
||||
#mainButtonTitle: mainButtonTitle,
|
||||
#showIconInSecondaryButton: showIconInSecondaryButton,
|
||||
#secondaryButtonTitle: secondaryButtonTitle,
|
||||
#showIconInAdditionalButton: showIconInAdditionalButton,
|
||||
#additionalButtonTitle: additionalButtonTitle,
|
||||
#takesInput: takesInput,
|
||||
#barrierColor: barrierColor,
|
||||
#barrierDismissible: barrierDismissible,
|
||||
#barrierLabel: barrierLabel,
|
||||
#useSafeArea: useSafeArea,
|
||||
#customData: customData,
|
||||
#data: data,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.DialogResponse<T>?>.value(),
|
||||
returnValueForMissingStub: _i5.Future<_i2.DialogResponse<T>?>.value(),
|
||||
) as _i5.Future<_i2.DialogResponse<T>?>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.DialogResponse<dynamic>?> showConfirmationDialog({
|
||||
String? title,
|
||||
String? description,
|
||||
String? cancelTitle = r'Cancel',
|
||||
_i6.Color? cancelTitleColor,
|
||||
String? confirmationTitle = r'Ok',
|
||||
_i6.Color? confirmationTitleColor,
|
||||
bool? barrierDismissible = false,
|
||||
_i2.DialogPlatform? dialogPlatform,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#showConfirmationDialog,
|
||||
[],
|
||||
{
|
||||
#title: title,
|
||||
#description: description,
|
||||
#cancelTitle: cancelTitle,
|
||||
#cancelTitleColor: cancelTitleColor,
|
||||
#confirmationTitle: confirmationTitle,
|
||||
#confirmationTitleColor: confirmationTitleColor,
|
||||
#barrierDismissible: barrierDismissible,
|
||||
#dialogPlatform: dialogPlatform,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.DialogResponse<dynamic>?>.value(),
|
||||
returnValueForMissingStub:
|
||||
_i5.Future<_i2.DialogResponse<dynamic>?>.value(),
|
||||
) as _i5.Future<_i2.DialogResponse<dynamic>?>);
|
||||
|
||||
@override
|
||||
void completeDialog(_i2.DialogResponse<dynamic>? response) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#completeDialog,
|
||||
[response],
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
}
|
||||
40
test/viewmodels/home_viewmodel_test.dart
Normal file
40
test/viewmodels/home_viewmodel_test.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:bahla_front/app/app.bottomsheets.dart';
|
||||
import 'package:bahla_front/app/app.locator.dart';
|
||||
import 'package:bahla_front/ui/common/app_strings.dart';
|
||||
import 'package:bahla_front/ui/views/home/home_viewmodel.dart';
|
||||
|
||||
import '../helpers/test_helpers.dart';
|
||||
|
||||
void main() {
|
||||
HomeViewModel getModel() => HomeViewModel();
|
||||
|
||||
group('HomeViewmodelTest -', () {
|
||||
setUp(() => registerServices());
|
||||
tearDown(() => locator.reset());
|
||||
|
||||
group('incrementCounter -', () {
|
||||
test('When called once should return Counter is: 1', () {
|
||||
final model = getModel();
|
||||
model.incrementCounter();
|
||||
expect(model.counterLabel, 'Counter is: 1');
|
||||
});
|
||||
});
|
||||
|
||||
group('showBottomSheet -', () {
|
||||
test('When called, should show custom bottom sheet using notice variant',
|
||||
() {
|
||||
final bottomSheetService = getAndRegisterBottomSheetService();
|
||||
|
||||
final model = getModel();
|
||||
model.showBottomSheet();
|
||||
verify(bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.notice,
|
||||
title: ksHomeBottomSheetTitle,
|
||||
description: ksHomeBottomSheetDescription,
|
||||
));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
11
test/viewmodels/info_alert_dialog_model_test.dart
Normal file
11
test/viewmodels/info_alert_dialog_model_test.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:bahla_front/app/app.locator.dart';
|
||||
|
||||
import '../helpers/test_helpers.dart';
|
||||
|
||||
void main() {
|
||||
group('InfoAlertDialogModel Tests -', () {
|
||||
setUp(() => registerServices());
|
||||
tearDown(() => locator.reset());
|
||||
});
|
||||
}
|
||||
11
test/viewmodels/notice_sheet_model_test.dart
Normal file
11
test/viewmodels/notice_sheet_model_test.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:bahla_front/app/app.locator.dart';
|
||||
|
||||
import '../helpers/test_helpers.dart';
|
||||
|
||||
void main() {
|
||||
group('InfoAlertDialogModel Tests -', () {
|
||||
setUp(() => registerServices());
|
||||
tearDown(() => locator.reset());
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user