6b5d12f3a1
ListView of three AdminSectionCard tiles (Requests / Quarantine / Users) showing live counts from adminCountsProvider. Pull-to-refresh re-fans-out to the three list endpoints. Admin/Quarantine/Users sub-routes will land in subsequent commits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 lines
1.5 KiB
Dart
47 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:minstrel/admin/admin_landing_screen.dart';
|
|
import 'package:minstrel/admin/admin_providers.dart';
|
|
import 'package:minstrel/auth/auth_provider.dart';
|
|
import 'package:minstrel/models/user.dart';
|
|
import 'package:minstrel/theme/theme_data.dart';
|
|
|
|
class _StubAuth extends AuthController {
|
|
@override
|
|
Future<User?> build() async =>
|
|
const User(id: 'u1', username: 'admin', isAdmin: true);
|
|
}
|
|
|
|
void main() {
|
|
testWidgets('renders three section cards with counts from provider',
|
|
(t) async {
|
|
await t.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
authControllerProvider.overrideWith(() => _StubAuth()),
|
|
adminCountsProvider.overrideWith(
|
|
(_) async => const AdminCounts(
|
|
requests: 3,
|
|
quarantine: 1,
|
|
users: 5,
|
|
),
|
|
),
|
|
],
|
|
child: MaterialApp(
|
|
theme: buildThemeData(),
|
|
home: const AdminLandingScreen(),
|
|
),
|
|
),
|
|
);
|
|
await t.pumpAndSettle();
|
|
expect(find.byKey(const Key('admin_card_requests')), findsOneWidget);
|
|
expect(find.byKey(const Key('admin_card_quarantine')), findsOneWidget);
|
|
expect(find.byKey(const Key('admin_card_users')), findsOneWidget);
|
|
expect(find.text('3'), findsOneWidget);
|
|
expect(find.text('1'), findsOneWidget);
|
|
expect(find.text('5'), findsOneWidget);
|
|
});
|
|
}
|