@@ -44,7 +44,7 @@ void main() {
44
44
{
45
45
'name' : '.._test_.fixtures_single_routes_index' ,
46
46
'path' : '../test/.fixtures/single/routes/index.dart' ,
47
- 'route' : 'routes'
47
+ 'route' : '/ routes'
48
48
}
49
49
]
50
50
}
@@ -62,6 +62,45 @@ void main() {
62
62
);
63
63
});
64
64
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
+
65
104
test ('includes nested routes' , () {
66
105
const expected = [
67
106
{
@@ -72,7 +111,7 @@ void main() {
72
111
{
73
112
'name' : '.._test_.fixtures_nested_routes_index' ,
74
113
'path' : '../test/.fixtures/nested/routes/index.dart' ,
75
- 'route' : 'routes'
114
+ 'route' : '/ routes'
76
115
}
77
116
]
78
117
},
@@ -161,7 +200,7 @@ void main() {
161
200
{
162
201
'name' : '.._test_.fixtures_dynamic_routes_index' ,
163
202
'path' : '../test/.fixtures/dynamic/routes/index.dart' ,
164
- 'route' : 'routes'
203
+ 'route' : '/ routes'
165
204
}
166
205
]
167
206
},
@@ -204,7 +243,7 @@ void main() {
204
243
{
205
244
'name' : '.._test_.fixtures_dynamic_nested_routes_index' ,
206
245
'path' : '../test/.fixtures/dynamic_nested/routes/index.dart' ,
207
- 'route' : 'routes'
246
+ 'route' : '/ routes'
208
247
},
209
248
{
210
249
'name' : r'.._test_.fixtures_dynamic_nested_routes_$user_$name' ,
0 commit comments