forked from eatvio/eatvio_app
52 lines
1.6 KiB
Dart
52 lines
1.6 KiB
Dart
import 'package:eatvio_app/core/app_config.dart';
|
||
import 'package:eatvio_app/core/app_initializer.dart';
|
||
import 'package:eatvio_app/core/locator_service.dart';
|
||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||
import 'package:eatvio_app/features/feed/presentation/widgets/chip_group.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
|
||
void main() {
|
||
group('ChipGroup smoke', () {
|
||
setUpAll(() async {
|
||
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
||
});
|
||
|
||
setUp(() async {
|
||
await sl.reset();
|
||
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
|
||
});
|
||
|
||
Widget wrap(Widget child) {
|
||
return MaterialApp(
|
||
theme: ThemeHelper().themeData(),
|
||
home: Scaffold(body: child),
|
||
);
|
||
}
|
||
|
||
testWidgets('renders chip group', (tester) async {
|
||
int selectedIndex = 0;
|
||
final chipsList = ['Все', 'Рецепты', 'Диеты'];
|
||
|
||
await tester.pumpWidget(
|
||
wrap(
|
||
ChipGroup(
|
||
selectedChipIndex: selectedIndex,
|
||
chipsLabelList: chipsList,
|
||
setSelectedChipIndex: (index) {
|
||
selectedIndex = index;
|
||
},
|
||
),
|
||
),
|
||
);
|
||
await tester.pumpAndSettle();
|
||
|
||
expect(find.byType(ChipGroup), findsOneWidget);
|
||
expect(find.text('Все'), findsOneWidget);
|
||
expect(find.text('Рецепты'), findsOneWidget);
|
||
expect(find.text('Диеты'), findsOneWidget);
|
||
});
|
||
});
|
||
}
|