platform/packages/route/test/chain_nest_test.dart

20 lines
524 B
Dart
Raw Normal View History

2017-03-17 17:36:04 +00:00
import 'package:angel_route/angel_route.dart';
import 'package:test/test.dart';
main() {
2019-11-28 17:40:32 +00:00
var router = Router<String>()
2018-08-20 18:59:51 +00:00
..chain(['a']).group('/b', (router) {
router.chain(['c']).chain(['d']).group('/e', (router) {
2017-03-17 17:36:04 +00:00
router.get('f', 'g');
});
})
..dumpTree();
test('nested route groups with chain', () {
2017-11-25 00:26:06 +00:00
var r = router.resolveAbsolute('/b/e/f')?.first?.route;
2017-03-17 17:36:04 +00:00
expect(r, isNotNull);
expect(r.handlers, hasLength(4));
expect(r.handlers, equals(['a', 'c', 'd', 'g']));
});
}