import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:health_app/pages/diet/diet_record_logic.dart';

void main() {
  test('recent diet dates end with today', () {
    final now = DateTime(2026, 7, 12, 21, 30);

    final dates = recentDietDates(now);

    expect(dates, hasLength(7));
    expect(dates.first, DateTime(2026, 7, 6));
    expect(dates.last, DateTime(2026, 7, 12));
  });

  test('blank food draft is not valid for saving', () {
    expect(isSavableFood(name: '', portion: '', calories: 0), isFalse);
  });

  test('diet row maps right swipe to edit and left swipe to delete', () {
    expect(
      dietRecordSwipeAction(DismissDirection.startToEnd),
      DietRecordSwipeAction.edit,
    );
    expect(
      dietRecordSwipeAction(DismissDirection.endToStart),
      DietRecordSwipeAction.delete,
    );
  });
}
