implement test

This commit is contained in:
Sergey Penkovsky
2025-05-13 23:19:10 +03:00
parent 28035a1ccd
commit 2c39ee48ad
4 changed files with 22 additions and 1 deletions

View File

@@ -17,3 +17,4 @@ dev_dependencies:
test: ^1.25.15
mockito: ^5.0.6
melos: ^6.3.2

View File

@@ -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('Without name.', () {
test('Binding resolves null', () {

View File

@@ -20,6 +20,7 @@ dev_dependencies:
sdk: flutter
flutter_lints: ^5.0.0
test: ^1.25.7
melos: ^6.3.2
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

View File

@@ -14,4 +14,4 @@ scripts:
exec: dart format
test:
exec: dart test ./test
exec: flutter test