import 'package:em2rp/views/widgets/event/equipment_selection_pagination.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  group('shouldAutoLoadNextPage', () {
    test('returns false when there is no more data', () {
      final result = shouldAutoLoadNextPage(
        hasMoreData: false,
        isLoadingMore: false,
        hasClients: true,
        maxScrollExtent: 100,
      );

      expect(result, isFalse);
    });

    test('returns false while a page is already loading', () {
      final result = shouldAutoLoadNextPage(
        hasMoreData: true,
        isLoadingMore: true,
        hasClients: true,
        maxScrollExtent: 0,
      );

      expect(result, isFalse);
    });

    test('returns true when list has no scroll client yet', () {
      final result = shouldAutoLoadNextPage(
        hasMoreData: true,
        isLoadingMore: false,
        hasClients: false,
        maxScrollExtent: 0,
      );

      expect(result, isTrue);
    });

    test('returns true when list is not scrollable yet', () {
      final result = shouldAutoLoadNextPage(
        hasMoreData: true,
        isLoadingMore: false,
        hasClients: true,
        maxScrollExtent: 0,
      );

      expect(result, isTrue);
    });

    test('returns false when list is scrollable', () {
      final result = shouldAutoLoadNextPage(
        hasMoreData: true,
        isLoadingMore: false,
        hasClients: true,
        maxScrollExtent: 250,
      );

      expect(result, isFalse);
    });
  });
}
