import 'package:flutter_test/flutter_test.dart';
import 'package:tane/db/enums.dart';
import 'package:tane/ui/category_palette.dart';

/// Category/form colours must be STABLE (same name → same tonality every
/// launch) so a family's chip and list header always match.
void main() {
  test('a category always maps to the same swatch', () {
    final a = categorySwatch('Solanáceas');
    final b = categorySwatch('Solanáceas');
    expect(a.fill, b.fill);
    expect(a.ink, b.ink);
  });

  test('different families generally get different tonalities', () {
    final names = [
      'Solanáceas',
      'Leguminosas',
      'Cucurbitáceas',
      'Brasicáceas',
      'Asteráceas',
      'Amarantáceas',
    ];
    final inks = {for (final n in names) categorySwatch(n).ink};
    // Not required to be all-distinct (palette wraps), but a fixed input set
    // must not collapse to a single colour.
    expect(inks.length, greaterThan(1));
  });

  test('every lot form has its own swatch', () {
    for (final type in LotType.values) {
      final s = lotTypeSwatch(type);
      expect(s.fill, isNotNull);
      expect(s.ink, isNotNull);
    }
  });
}
