import 'package:flutter_test/flutter_test.dart';
import 'package:health_app/models/ble_device.dart';
import 'package:health_app/pages/chart/trend_page.dart';
import 'package:health_app/pages/remaining_pages.dart';
import 'package:health_app/services/health_ble_service.dart';

void main() {
  test('unknown trend metric falls back to blood pressure', () {
    expect(normalizeTrendMetricType('unknown_metric'), 'blood_pressure');
    expect(normalizeTrendMetricType(null), 'blood_pressure');
    expect(normalizeTrendMetricType('spo2'), 'spo2');
  });

  test('static compliance pages include collection and sdk lists', () {
    expect(staticTextTitle('personalInfoList'), '个人信息收集清单');
    expect(staticTextContent('personalInfoList'), contains('健康数据'));

    expect(staticTextTitle('thirdPartySdkList'), '第三方 SDK 共享清单');
    expect(staticTextContent('thirdPartySdkList'), contains('AI'));
  });

  test('ble sync is only implemented for blood pressure devices', () {
    expect(
      HealthBleService.isSyncImplemented(BleDeviceType.bloodPressure),
      true,
    );
    expect(HealthBleService.isSyncImplemented(BleDeviceType.glucose), false);
    expect(
      HealthBleService.isSyncImplemented(BleDeviceType.weightScale),
      false,
    );
    expect(
      HealthBleService.isSyncImplemented(BleDeviceType.pulseOximeter),
      false,
    );
  });
}
