2024-09-25 04:04:57 +00:00
|
|
|
import 'package:platform_route/route.dart';
|
2024-09-23 01:46:14 +00:00
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
var router = Router<String>()
|
|
|
|
..chain(['a']).group('/b', (router) {
|
|
|
|
router.chain(['c']).chain(['d']).group('/e', (router) {
|
|
|
|
router.get('f', 'g');
|
|
|
|
});
|
|
|
|
})
|
|
|
|
..dumpTree();
|
|
|
|
|
|
|
|
test('nested route groups with chain', () {
|
|
|
|
var r = router.resolveAbsolute('/b/e/f').first.route;
|
|
|
|
expect(r, isNotNull);
|
|
|
|
expect(r.handlers, hasLength(4));
|
|
|
|
expect(r.handlers, equals(['a', 'c', 'd', 'g']));
|
|
|
|
});
|
|
|
|
}
|