import 'package:flutter_test/flutter_test.dart';
import 'package:rasadyar_core/presentation/utils/list_extensions.dart';

void main(){
  group('toggle test', (){

    List<int> list = [1, 2, 3];

    test('should remove item if it exists', () {
      list.toggle(2);
      expect(list, [1, 3]);
    });


    test('should add item if it not  exists', () {
      list.toggle(10);
      expect(list, [1, 3 , 10]);
    });




  });
  group('insert to first item' ,(){

    List<int> list = [1, 2, 3];

    test('should insert item at start if it does not exist', () {
      list.ensureContainsAtStart(0);
      expect(list, [0, 1, 2, 3]);
    });

    test('should not insert item at start if it already exists', () {
      list.ensureContainsAtStart(2);
      expect(list, [0, 1, 2, 3]);
    });



  });
  group('clear and add item' ,(){

    List<int> list = [1, 2, 3];

    test('must be clear and add item ', () {
      list.resetWith(20);
      expect(list, [20]);
    });



  });
}
