import 'package:flutter_test/flutter_test.dart';
import 'package:health_app/utils/backoffice_formatters.dart';

void main() {
  test('formats report time without assuming a minimum string length', () {
    expect(formatBackofficeDateTime(null), '时间未知');
    expect(formatBackofficeDateTime(''), '时间未知');
    expect(formatBackofficeDateTime('2026-07-17'), '2026-07-17');
    expect(
      formatBackofficeDateTime('2026-07-17T10:20:30Z'),
      '2026-07-17 10:20',
    );
  });

  test('builds a safe avatar initial for empty or missing names', () {
    expect(backofficeInitial(null), '?');
    expect(backofficeInitial(''), '?');
    expect(backofficeInitial('  '), '?');
    expect(backofficeInitial('小脉'), '小');
  });
}
