MotorSignal-App/test/router_test.dart

55 lines
2.0 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:motorcycle_dash/core/router.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
group('appRouter Route Configuration Tests', () {
test('routes include /social/clubs and subroutes', () {
final config = appRouter.configuration;
// Verify match locations can be resolved without GoException
final matchClubs = config.findMatch(Uri.parse('/social/clubs'));
expect(matchClubs.matches.isNotEmpty, isTrue);
final matchCreate = config.findMatch(Uri.parse('/social/clubs/create'));
expect(matchCreate.matches.isNotEmpty, isTrue);
final matchDetail = config.findMatch(Uri.parse('/social/clubs/c123'));
expect(matchDetail.matches.isNotEmpty, isTrue);
});
test('routes include /social base and other social routes', () {
final config = appRouter.configuration;
final matchSocial = config.findMatch(Uri.parse('/social'));
expect(matchSocial.matches.isNotEmpty, isTrue);
final matchProfile = config.findMatch(Uri.parse('/social/profile'));
expect(matchProfile.matches.isNotEmpty, isTrue);
final matchFriends = config.findMatch(Uri.parse('/social/friends'));
expect(matchFriends.matches.isNotEmpty, isTrue);
final matchSocialFeed = config.findMatch(Uri.parse('/social/feed'));
expect(matchSocialFeed.matches.isNotEmpty, isTrue);
final matchFeed = config.findMatch(Uri.parse('/feed'));
expect(matchFeed.matches.isNotEmpty, isTrue);
});
test('routes include /replay and /replay/:id subroute', () {
final config = appRouter.configuration;
final matchReplay = config.findMatch(Uri.parse('/replay'));
expect(matchReplay.matches.isNotEmpty, isTrue);
final matchReplayWithId = config.findMatch(Uri.parse('/replay/42'));
expect(matchReplayWithId.matches.isNotEmpty, isTrue);
final matchReplayWithQuery = config.findMatch(Uri.parse('/replay?rideId=42'));
expect(matchReplayWithQuery.matches.isNotEmpty, isTrue);
});
});
}