test filter scenario

0

I would like to know the best way to test (with jasmine) a filter with this scenario:

function districtFilter(city, array) {
    var districtFound = array.filter(function(a) {
        return a.id !== city.id;
    });
    return districtFound;
}
    
asked by anonymous 13.04.2018 / 15:55

1 answer

-1
var array = [
{
  id: 1,
  city: "Washington"
},
{
  id: 2,
  city: "Chicago"
},
{
  id: 3,
  city: "New York"
}];

var city = {
  id: 1,
  city: "Washington"
};

console.log(districtFilter(city, array));
    
16.04.2018 / 08:21