Fix school browser initialization and redirect detection; improve diagnostics

This commit is contained in:
Codex
2026-10-15 12:23:35 +08:00
parent 46e26ec548
commit a4c2df838e
20 changed files with 530 additions and 17 deletions
@@ -33,6 +33,39 @@ class FakeFeedbackHttpTransport implements FeedbackHttpTransport {
}
void main() {
test(
'old feedback service gets a specific diagnostic-upgrade hint',
() async {
final transport = FakeFeedbackHttpTransport()
..response = FeedbackHttpResponse(
422,
utf8.encode(
'{"error":"validation_error","detail":"Unexpected file field."}',
),
);
await expectLater(
HttpFeedbackSender(
endpoint: 'https://example.com/v1/feedback',
transport: transport,
).send(
FeedbackSubmission.problem(
id: 'same-id',
message: '问题',
diagnosticLog: Uint8List.fromList(
utf8.encode('TPSchedule diagnostic log\n'),
),
),
),
throwsA(
isA<FeedbackException>().having(
(e) => e.message,
'upgrade hint',
allOf(contains('日志'), contains('更新')),
),
),
);
},
);
test('diagnostics use a separate UTF8 attachment field', () async {
final transport = FakeFeedbackHttpTransport();
await HttpFeedbackSender(