Skip to content

Commit

Permalink
Fix test by refactoring unrelated DashTool static method
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasyishak committed Mar 27, 2024
1 parent 3977ae8 commit d71b224
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 9 additions & 2 deletions pkgs/unified_analytics/lib/src/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,15 @@ enum DashTool {

/// This takes in the string label for a given [DashTool] and returns the
/// enum for that string label.
static DashTool? fromLabel(String label) =>
DashTool.values.firstWhereOrNull((e) => e.label == label);
static DashTool? fromLabel(String label) {
for (final tool in DashTool.values) {
if (tool.label == label) return tool;
}

throw Exception('The tool $label from the survey metadata file is not '
'a valid DashTool enum value\n'
'Valid labels for dash tools: ${validDashTools.join(', ')}');
}
}

/// Enumerate options for platforms supported.
Expand Down
1 change: 0 additions & 1 deletion pkgs/unified_analytics/lib/src/survey_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import 'dart:convert';

import 'package:clock/clock.dart';
import 'package:collection/collection.dart';
import 'package:file/file.dart';
import 'package:http/http.dart' as http;

Expand Down

0 comments on commit d71b224

Please sign in to comment.