platform/packages/route/test/chain_nest_test.dart
Tobe O 5eef4314ec Add 'packages/route/' from commit '8b2b0524609ab737eb5569fdf82a7ac491fdc67b'
git-subtree-dir: packages/route
git-subtree-mainline: 6db839928b
git-subtree-split: 8b2b052460
2020-02-15 18:22:17 -05:00

19 lines
524 B
Dart

import 'package:angel_route/angel_route.dart';
import 'package:test/test.dart';
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']));
});
}