@include test-module('Sassdash') {
  @include test('_where') {
    $maps: (
      ( 'a': 1 ),
      ( 'a': 1 ),
      ( 'a': 1, 'b': 2 ),
      ( 'a': 2, 'b': 2 ),
      ( 'a': 3 )
    );

    $pairs: (
      (( 'a': 1 ), (( 'a': 1 ), ( 'a': 1 ), ( 'a': 1, 'b': 2 ))),
      (( 'a': 2 ), (( 'a': 2, 'b': 2 ),)),
      (( 'a': 3 ), (( 'a': 3 ),)),
      (( 'b': 1 ), ()),
      (( 'b': 2 ), (( 'a': 1, 'b': 2 ), ( 'a': 2, 'b': 2 ))),
      (( 'a': 1, 'b': 2 ), (( 'a': 1, 'b': 2 ),))
    );

    @each $pair in $pairs {
      $actual: _where($maps, nth($pair, 1));

      @include assert-true(test-lists-equal($actual, nth($pair, 2)),
        'should filter by source properties');
    }

    $map: (
      'x': ( 'a': 1 ),
      'y': ( 'a': 3 ),
      'z': ( 'a': 1, 'b': 2 )
    );

    @include assert-equal(_where($map, ('a': 1)), __get($map, 'x') __get($map, 'z'),
      'should work with a map for collection');

    $list: (
      ('a': 1),
      ('a': 3),
      ('a': 1, 'b': 2)
    );

    $actual: _($list, _where ('a': 1));

    @include assert-equal($actual, nth($list, 1) nth($list, 3),
      'should work in a lazy chain sequence');
  }
}
