Update utils_test.dart to reflect renaming of the tab appsize to app-size (#7186)
* Update utils_test.dart
updating the url, eventough the url does not have any effect in this test. This is mostly a cleanup as this is the last place where this is still the old path
* Update utils.dart
Fixes parsing of query parameters for paths with a hyphen
* Make sure that all screens can receive query params
* remove pound from path
---------
Co-authored-by: Damian Bast <me@damianbast.com>
diff --git a/packages/devtools_app/lib/src/shared/primitives/utils.dart b/packages/devtools_app/lib/src/shared/primitives/utils.dart
index ced88cb..1600f62 100644
--- a/packages/devtools_app/lib/src/shared/primitives/utils.dart
+++ b/packages/devtools_app/lib/src/shared/primitives/utils.dart
@@ -1167,7 +1167,7 @@
// http://localhost:123/#/page-id?key=value
// Since we just want the query params, we will modify the url to have an
// easy-to-parse form.
- return url.replaceFirst(RegExp(r'#\/(\w*)[?]'), '?');
+ return url.replaceFirst(RegExp(r'#\/([\w\-]*)[?]'), '?');
}
Map<String, String> devToolsQueryParams(String url) {
diff --git a/packages/devtools_app/test/primitives/utils_test.dart b/packages/devtools_app/test/primitives/utils_test.dart
index 6e84319..b49e9eb 100644
--- a/packages/devtools_app/test/primitives/utils_test.dart
+++ b/packages/devtools_app/test/primitives/utils_test.dart
@@ -4,6 +4,7 @@
import 'package:collection/collection.dart';
import 'package:devtools_app/src/shared/primitives/utils.dart';
+import 'package:devtools_app/src/shared/screen.dart';
import 'package:devtools_app/src/shared/utils.dart';
import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
@@ -660,21 +661,23 @@
}),
);
expect(
- devToolsQueryParams('http://localhost:123/#/?key=value.json&key2=123'),
+ devToolsQueryParams('http://localhost:123/?key=value.json&key2=123'),
equals({
'key': 'value.json',
'key2': '123',
}),
);
- expect(
- devToolsQueryParams(
- 'http://localhost:9101/#/appsize?key=value.json&key2=123',
- ),
- equals({
- 'key': 'value.json',
- 'key2': '123',
- }),
- );
+ for (final meta in ScreenMetaData.values) {
+ expect(
+ devToolsQueryParams(
+ 'http://localhost:9101/${meta.id}?key=value.json&key2=123',
+ ),
+ equals({
+ 'key': 'value.json',
+ 'key2': '123',
+ }),
+ );
+ }
});
group('safeDivide', () {