fix(routing): move clubs route to social branch
This commit is contained in:
parent
2e76561f67
commit
41f19be57a
|
|
@ -137,6 +137,23 @@ final appRouter = GoRouter(
|
|||
path: 'friends',
|
||||
builder: (context, state) => const FriendsScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'clubs',
|
||||
builder: (context, state) => const ClubsHubScreen(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'create',
|
||||
builder: (context, state) => const CreateClubScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: ':id',
|
||||
builder: (context, state) {
|
||||
final id = state.pathParameters['id']!;
|
||||
return ClubDetailScreen(clubId: id);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
@ -163,23 +180,6 @@ final appRouter = GoRouter(
|
|||
path: 'friends',
|
||||
builder: (context, state) => const FriendsScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'clubs',
|
||||
builder: (context, state) => const ClubsHubScreen(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'create',
|
||||
builder: (context, state) => const CreateClubScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: ':id',
|
||||
builder: (context, state) {
|
||||
final id = state.pathParameters['id']!;
|
||||
return ClubDetailScreen(clubId: id);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
GoRoute(
|
||||
path: 'diagnostics',
|
||||
builder: (context, state) => const DiagnosticsScreen(),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue