forked from eatvio/eatvio_app
feat(insights): review fixes
This commit is contained in:
@@ -97,7 +97,10 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(repository.serverRequests.single.dailyPeriod, DailyPeriod.month);
|
||||
expect(repository.serverRequests.single.bodyPeriod, BodyPeriod.threeMonths);
|
||||
expect(
|
||||
repository.serverRequests.single.bodyPeriod,
|
||||
BodyPeriod.threeMonths,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('без daily показывает заглушку', (tester) async {
|
||||
@@ -150,32 +153,32 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('на сегодняшнем дне «следующий день» отключён, «предыдущий» нет', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpKbjuCard(
|
||||
tester,
|
||||
FakeInsightsRepository(),
|
||||
'insights_tab_intra',
|
||||
);
|
||||
testWidgets(
|
||||
'на сегодняшнем дне «следующий день» отключён, «предыдущий» нет',
|
||||
(tester) async {
|
||||
await pumpKbjuCard(
|
||||
tester,
|
||||
FakeInsightsRepository(),
|
||||
'insights_tab_intra',
|
||||
);
|
||||
|
||||
IconButton buttonIn(String key) => tester.widget<IconButton>(
|
||||
find.descendant(
|
||||
of: find.byKey(Key(key)),
|
||||
matching: find.byType(IconButton),
|
||||
),
|
||||
);
|
||||
IconButton buttonIn(String key) => tester.widget<IconButton>(
|
||||
find.descendant(
|
||||
of: find.byKey(Key(key)),
|
||||
matching: find.byType(IconButton),
|
||||
),
|
||||
);
|
||||
|
||||
expect(buttonIn('insights_intra_next').onPressed, isNull);
|
||||
expect(buttonIn('insights_intra_prev').onPressed, isNotNull);
|
||||
});
|
||||
expect(buttonIn('insights_intra_next').onPressed, isNull);
|
||||
expect(buttonIn('insights_intra_prev').onPressed, isNotNull);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('«предыдущий день» запрашивает только intra и меняет дату', (
|
||||
tester,
|
||||
) async {
|
||||
final repository = FakeInsightsRepository();
|
||||
repository.intraByDate['2026-11-08'] = loadInsightsPayloadFixture()
|
||||
.intra!
|
||||
repository.intraByDate['2026-11-08'] = loadInsightsPayloadFixture().intra!
|
||||
.copyWith(date: '2026-11-08', dateLabel: '8 ноября', isToday: false);
|
||||
await pumpKbjuCard(tester, repository, 'insights_tab_intra');
|
||||
repository.serverRequests.clear();
|
||||
@@ -312,6 +315,34 @@ void main() {
|
||||
expect(find.byType(IntraLegend), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('день только со сном рисует затемнение, без заглушки', (
|
||||
tester,
|
||||
) async {
|
||||
final intra = loadInsightsPayloadFixture().intra!.copyWith(
|
||||
bars: const [],
|
||||
satiety: const [],
|
||||
mood: const [],
|
||||
);
|
||||
await pumpKbjuCard(
|
||||
tester,
|
||||
FakeInsightsRepository(
|
||||
payload: loadInsightsPayloadFixture().copyWith(intra: intra),
|
||||
),
|
||||
'insights_tab_intra',
|
||||
);
|
||||
|
||||
expect(find.byKey(const Key('insights_intra_chart')), findsOneWidget);
|
||||
expect(find.text('Недостаточно данных'), findsNothing);
|
||||
final xAxis =
|
||||
tester
|
||||
.widget<SfCartesianChart>(
|
||||
find.byKey(const Key('insights_intra_chart')),
|
||||
)
|
||||
.primaryXAxis
|
||||
as NumericAxis;
|
||||
expect(xAxis.plotBands, isNotEmpty);
|
||||
});
|
||||
|
||||
testWidgets('пустой день показывает заглушку', (tester) async {
|
||||
await pumpKbjuCard(
|
||||
tester,
|
||||
|
||||
Reference in New Issue
Block a user