@@ -44,7 +44,7 @@ void main() {
4444 {
4545 'name' : '.._test_.fixtures_single_routes_index' ,
4646 'path' : '../test/.fixtures/single/routes/index.dart' ,
47- 'route' : 'routes'
47+ 'route' : '/ routes'
4848 }
4949 ]
5050 }
@@ -62,6 +62,45 @@ void main() {
6262 );
6363 });
6464
65+ test ('includes multiple top-level routes' , () {
66+ const expected = [
67+ {
68+ 'name' : '_' ,
69+ 'route' : '/' ,
70+ 'middleware' : false ,
71+ 'files' : [
72+ {
73+ 'name' : '.._test_.fixtures_multiple_top_level_routes_index' ,
74+ 'path' : '../test/.fixtures/multiple_top_level/routes/index.dart' ,
75+ 'route' : '/routes'
76+ },
77+ {
78+ 'name' : '.._test_.fixtures_multiple_top_level_routes_hello' ,
79+ 'path' : '../test/.fixtures/multiple_top_level/routes/hello.dart' ,
80+ 'route' : '/hello'
81+ }
82+ ]
83+ }
84+ ];
85+ final directory = Directory (
86+ path.join (
87+ Directory .current.path,
88+ 'test' ,
89+ '.fixtures' ,
90+ 'multiple_top_level' ,
91+ ),
92+ )..createSync (recursive: true );
93+ final routes = Directory (path.join (directory.path, 'routes' ))
94+ ..createSync ();
95+ File (path.join (routes.path, 'index.dart' )).createSync ();
96+ File (path.join (routes.path, 'hello.dart' )).createSync ();
97+ final configuration = buildRouteConfiguration (directory);
98+ expect (
99+ configuration.directories.map ((d) => d.toJson ()).toList (),
100+ equals (expected),
101+ );
102+ });
103+
65104 test ('includes nested routes' , () {
66105 const expected = [
67106 {
@@ -72,7 +111,7 @@ void main() {
72111 {
73112 'name' : '.._test_.fixtures_nested_routes_index' ,
74113 'path' : '../test/.fixtures/nested/routes/index.dart' ,
75- 'route' : 'routes'
114+ 'route' : '/ routes'
76115 }
77116 ]
78117 },
@@ -161,7 +200,7 @@ void main() {
161200 {
162201 'name' : '.._test_.fixtures_dynamic_routes_index' ,
163202 'path' : '../test/.fixtures/dynamic/routes/index.dart' ,
164- 'route' : 'routes'
203+ 'route' : '/ routes'
165204 }
166205 ]
167206 },
@@ -204,7 +243,7 @@ void main() {
204243 {
205244 'name' : '.._test_.fixtures_dynamic_nested_routes_index' ,
206245 'path' : '../test/.fixtures/dynamic_nested/routes/index.dart' ,
207- 'route' : 'routes'
246+ 'route' : '/ routes'
208247 },
209248 {
210249 'name' : r'.._test_.fixtures_dynamic_nested_routes_$user_$name' ,
0 commit comments