feat: 切换邮箱认证并重构前后端启动与门禁
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meeyao_qianwen/core/network/api_problem.dart';
|
||||
import 'package:meeyao_qianwen/core/network/api_problem_mapper.dart';
|
||||
import 'package:meeyao_qianwen/l10n/app_localizations.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('map by code uses localized message', (tester) async {
|
||||
late AppLocalizations l10n;
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
l10n = AppLocalizations.of(context)!;
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final message = mapApiProblemToMessage(
|
||||
ApiProblem(
|
||||
status: 401,
|
||||
title: 'Unauthorized',
|
||||
detail: 'Invalid verification code',
|
||||
code: 'AUTH_VERIFICATION_CODE_INVALID',
|
||||
),
|
||||
l10n,
|
||||
);
|
||||
|
||||
expect(message, l10n.errorInvalidVerificationCode);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user