mirrored_repositories/pmodoro-application/test/features/task_management/data
import "dart:convert";
import "dart:io";

import "package:flutter_test/flutter_test.dart";
import "package:pomodore/features/task_management/data/models/daily_information_model.dart";
import "package:pomodore/features/task_management/domain/entities/daily_information_entity.dart";

void main() {
  group("Daily Information Test", () {
    test("Test daily information model to json method", () {
      final file = File("test/test_resources/random_daily_information.json")
          .readAsStringSync();

      final Map<String, dynamic> json = Map<String, dynamic>.from(jsonDecode(file));
      final DailyInformationEntity dailyInformationEntity =
          DailyInformationModel.fromJson(json);

      expect(dailyInformationEntity.taskQuantity, 1);
      expect(dailyInformationEntity.completedTaskQuantity, 1);
      expect(dailyInformationEntity.dailyGoalQuantity, 1);
      expect(dailyInformationEntity.processPercentage, 100);
    });
    test("Test daily information model from json method", () {
      final file = File("test/test_resources/random_daily_information.json")
          .readAsStringSync();
      final Map<String, dynamic> json = Map<String, dynamic>.from(jsonDecode(file));
      final DailyInformationEntity dailyInformationEntity =
          DailyInformationModel.fromJson(json);

      final Map<String, dynamic> raw =
          DailyInformationModel.toJson(dailyInformationEntity);

      expect(raw["taskQuantity"], 1);
      expect(raw["completedTaskQuantity"], 1);
      expect(raw["dailyGoalQuantity"], 1);
      expect(raw["processPercentage"], 100.0);
    });
  });
}
