Single Flutter codebase under client/app/ with web enabled (mobile/desktop can be added later; lib/ is platform-agnostic). Talks to the NestJS backend via a thin REST wrapper; API_BASE is a --dart-define (defaults to the local backend). Screens: - Login: Konfi/guest (invite code), local Teamer password login, Teamer invite redemption. Token persisted in shared_preferences, restored on start; GET /auth/me drives a role-aware home. - Workshop-Wahl (guests): loads /wahl/guest/overview, ordered pick of up to 3 workshops, submits to /wahl/:id/teilnehmer. - Dateien: /files/:kcId list. - Chat: channel + message list (read-only; WS send is a follow-up). State: AppState (ChangeNotifier) exposed via an InheritedNotifier (AppScope) — no third-party state package. flutter analyze clean, flutter build web --release passes, one widget smoke test. Also: interim client/web/ HTML placeholder stays as-is (per plan it is superseded by this Flutter web build). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
23 lines
867 B
Dart
23 lines
867 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:kc_app/api.dart';
|
|
import 'package:kc_app/main.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
void main() {
|
|
testWidgets('shows the login screen when there is no stored token', (tester) async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
final state = AppState(Api(http.Client()));
|
|
await state.bootstrap(); // no stored token -> resolves immediately, no network
|
|
|
|
await tester.pumpWidget(KcApp(state: state));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.text('Konfi / Gast'), findsOneWidget);
|
|
expect(find.text('Team-Login'), findsOneWidget);
|
|
expect(find.text('Einladung'), findsOneWidget);
|
|
expect(find.widgetWithText(FilledButton, 'Weiter'), findsWidgets);
|
|
});
|
|
}
|