mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
implement test
This commit is contained in:
@@ -17,3 +17,4 @@ dev_dependencies:
|
|||||||
test: ^1.25.15
|
test: ^1.25.15
|
||||||
|
|
||||||
mockito: ^5.0.6
|
mockito: ^5.0.6
|
||||||
|
melos: ^6.3.2
|
||||||
|
|||||||
@@ -188,6 +188,25 @@ void main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
group('Check Async provider.', () {
|
||||||
|
test('Binding resolves value asynchronously', () async {
|
||||||
|
final expectedValue = 5;
|
||||||
|
final binding = Binding<int>().toProvideAsync(() async => expectedValue);
|
||||||
|
|
||||||
|
final result = await binding.asyncProvider?.call();
|
||||||
|
expect(result, expectedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Binding resolves value asynchronously with params', () async {
|
||||||
|
final expectedValue = 5;
|
||||||
|
final binding = Binding<int>().toProvideAsyncWithParams(
|
||||||
|
(param) async => expectedValue + (param as int));
|
||||||
|
|
||||||
|
final result = await binding.asyncProviderWithParams?.call(3);
|
||||||
|
expect(result, expectedValue + 3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
group('Check singleton provide.', () {
|
group('Check singleton provide.', () {
|
||||||
group('Without name.', () {
|
group('Without name.', () {
|
||||||
test('Binding resolves null', () {
|
test('Binding resolves null', () {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ dev_dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^5.0.0
|
flutter_lints: ^5.0.0
|
||||||
test: ^1.25.7
|
test: ^1.25.7
|
||||||
|
melos: ^6.3.2
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ scripts:
|
|||||||
exec: dart format
|
exec: dart format
|
||||||
|
|
||||||
test:
|
test:
|
||||||
exec: dart test ./test
|
exec: flutter test
|
||||||
Reference in New Issue
Block a user