Skip to content

Commit

Permalink
Fix show events on home screen (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sneha-s authored Mar 21, 2024
1 parent ed88e47 commit c0e33d7
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/data/di/service_locator.config.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions lib/data/repo/employee_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:rxdart/rxdart.dart';
import '../model/employee/employee.dart';
import '../services/employee_service.dart';

@LazySingleton()
@Singleton()
class EmployeeRepo {
final EmployeeService _employeeService;
final UserStateNotifier _userStateNotifier;
Expand All @@ -34,7 +34,12 @@ class EmployeeRepo {
Stream<List<Employee>> get employees =>
_employeeController.stream.asBroadcastStream();

List<Employee> get allEmployees => _employeeController.value;
List<Employee> get allEmployees {
if (_employeeController.hasValue) {
return _employeeController.stream.value;
}
return [];
}

Stream<List<Employee>> get activeEmployees =>
_employeeController.stream.asyncMap((employees) => employees
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Mocks generated by Mockito 5.4.4 from annotations
// in projectunity/test/unit_test/shared/events/celebration_event_bloc_test.dart.
// Do not manually edit this file.

// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i3;

import 'package:mockito/mockito.dart' as _i1;
import 'package:projectunity/data/model/employee/employee.dart' as _i4;
import 'package:projectunity/data/repo/employee_repo.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 [EmployeeRepo].
///
/// See the documentation for Mockito's code generation for more information.
class MockEmployeeRepo extends _i1.Mock implements _i2.EmployeeRepo {
MockEmployeeRepo() {
_i1.throwOnMissingStub(this);
}

@override
_i3.Stream<List<_i4.Employee>> get employees => (super.noSuchMethod(
Invocation.getter(#employees),
returnValue: _i3.Stream<List<_i4.Employee>>.empty(),
) as _i3.Stream<List<_i4.Employee>>);

@override
List<_i4.Employee> get allEmployees => (super.noSuchMethod(
Invocation.getter(#allEmployees),
returnValue: <_i4.Employee>[],
) as List<_i4.Employee>);

@override
_i3.Stream<List<_i4.Employee>> get activeEmployees => (super.noSuchMethod(
Invocation.getter(#activeEmployees),
returnValue: _i3.Stream<List<_i4.Employee>>.empty(),
) as _i3.Stream<List<_i4.Employee>>);

@override
_i3.Stream<_i4.Employee?> memberDetails(String? uid) => (super.noSuchMethod(
Invocation.method(
#memberDetails,
[uid],
),
returnValue: _i3.Stream<_i4.Employee?>.empty(),
) as _i3.Stream<_i4.Employee?>);

@override
_i3.Future<void> reset() => (super.noSuchMethod(
Invocation.method(
#reset,
[],
),
returnValue: _i3.Future<void>.value(),
returnValueForMissingStub: _i3.Future<void>.value(),
) as _i3.Future<void>);

@override
_i3.Future<void> dispose() => (super.noSuchMethod(
Invocation.method(
#dispose,
[],
),
returnValue: _i3.Future<void>.value(),
returnValueForMissingStub: _i3.Future<void>.value(),
) as _i3.Future<void>);
}

0 comments on commit c0e33d7

Please sign in to comment.