LCOV - code coverage report
Current view: top level - lib/shared/reducers - select_adventure_node_reducer.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 21 21 100.0 %
Date: 2022-03-03 12:16:40 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:redux/redux.dart';
       2             : 
       3             : import '../../adventures/models/adventure_model.dart';
       4             : import '../../app_state.dart';
       5             : import '../../challenges/models/challenge_model.dart';
       6             : import '../../challenges/models/challenges_state.dart';
       7             : import '../../steps/models/step_model.dart';
       8             : import '../../steps/models/steps_state.dart';
       9             : import '../../tasks/models/task_model.dart';
      10             : import '../../tasks/models/tasks_state.dart';
      11             : import '../actions/select_adventure_node_action.dart';
      12             : 
      13             : class SelectAdventureNodeReducer
      14             :     extends TypedReducer<AppState, SelectAdventureNodeAction> {
      15           1 :   SelectAdventureNodeReducer()
      16           2 :       : super((state, action) {
      17           1 :           var model = action.selection;
      18           1 :           if (model.isAdventure()) {
      19           2 :             return state.copyWith(
      20           1 :                 adventures: state.adventures
      21           3 :                     .copyWith(selected: action.selection as AdventureModel),
      22           1 :                 challenges: ChallengesState.init());
      23             :           }
      24             : 
      25           1 :           if (model.isChallenge()) {
      26           2 :             return state.copyWith(
      27           1 :                 challenges: state.challenges
      28           3 :                     .copyWith(selected: action.selection as ChallengeModel),
      29           1 :                 tasks: TasksState.init());
      30             :           }
      31             : 
      32           1 :           if (model.isTask()) {
      33           2 :             return state.copyWith(
      34           1 :                 tasks: state.tasks
      35           3 :                     .copyWith(selected: action.selection as TaskModel),
      36           1 :                 steps: StepsState.init());
      37             :           }
      38             : 
      39           1 :           if (model.isStep()) {
      40           1 :             return state.copyWith
      41           3 :                 .steps(selected: action.selection as StepModel);
      42             :           }
      43             : 
      44             :           return state;
      45             :         });
      46             : }

Generated by: LCOV version 1.13