38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
// Author: fruit.com.cn
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:fruitshorts/core/config/app_config.dart';
|
|
import 'package:fruitshorts/l10n/app_localizations.dart';
|
|
import 'package:fruitshorts/pages/settings/legal_links_card.dart';
|
|
|
|
void main() {
|
|
tearDown(AppConfig.clearRuntimeBaseUrl);
|
|
|
|
testWidgets('should_open_terms_and_privacy_for_the_current_language', (
|
|
tester,
|
|
) async {
|
|
AppConfig.applyRuntimeBaseUrl('http://192.168.31.243:8081/');
|
|
final opened = <String>[];
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
locale: const Locale('id'),
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
home: Scaffold(
|
|
body: LegalLinksCard(open: (url) async => opened.add(url)),
|
|
),
|
|
),
|
|
);
|
|
|
|
await tester.tap(find.byKey(const Key('settings-terms')));
|
|
await tester.tap(find.byKey(const Key('settings-privacy')));
|
|
await tester.pump();
|
|
|
|
expect(opened, [
|
|
'http://192.168.31.243:8081/terms/id',
|
|
'http://192.168.31.243:8081/privacy/id',
|
|
]);
|
|
});
|
|
}
|