import 'dart:io';

import 'package:flutter_test/flutter_test.dart';

void main() {
  test('domain layer does not import Flutter or Drift', () {
    final domainDirectory = Directory('lib/domain');
    final dartFiles = domainDirectory
        .listSync(recursive: true)
        .whereType<File>()
        .where((file) => file.path.endsWith('.dart'));

    for (final file in dartFiles) {
      final source = file.readAsStringSync();

      expect(source, isNot(contains('package:flutter/')), reason: file.path);
      expect(source, isNot(contains('package:drift/')), reason: file.path);
      expect(
        source,
        isNot(contains('package:drift_flutter/')),
        reason: file.path,
      );
    }
  });
}
