Preserve courses with pending rooms and report precise graduate import errors

This commit is contained in:
david1465833828
2026-10-28 19:56:02 +08:00
parent 8713bce0ee
commit 21b0df9e33
17 changed files with 340 additions and 53 deletions
@@ -31,7 +31,7 @@ void main() {
session.dispose();
controller.dispose();
});
Future<void> open(WidgetTester tester) async {
Future<void> open(WidgetTester tester, {String? timetableHtml}) async {
controller = AppController(
store,
FakeNotifications(),
@@ -43,8 +43,9 @@ void main() {
platform.web.javascript = (s) async => underEvidence(
platform.web.url!,
html: s == undergraduateCaptureScript
? File('test/fixtures/school/undergraduate-timetable.html')
.readAsStringSync()
? timetableHtml ??
File('test/fixtures/school/undergraduate-timetable.html')
.readAsStringSync()
: null,
);
platform.delegate.finished(platform.web.url!);
@@ -85,6 +86,21 @@ void main() {
expect(find.text('打开'), findsOneWidget);
SchoolPageDiagnostic.instance.clear();
});
testWidgets('missing room imports with a visible pending-room notice', (
tester,
) async {
await open(
tester,
timetableHtml: File('test/fixtures/school/undergraduate-timetable.html')
.readAsStringSync()
.replaceFirst('"教室1"', '""'),
);
await tester.tap(find.text('导入当前课表'));
await tester.pumpAndSettle();
expect(controller.snapshot.courses.any((c) => c.room == '教室待定'), isTrue);
expect(find.textContaining('部分课程教室待定'), findsOneWidget);
SchoolPageDiagnostic.instance.clear();
});
testWidgets('cross school replacement can be cancelled without saving', (
tester,
) async {