test filter scenario

Asked

Viewed 48 times

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;
}

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));
  • It would be in unit test, using the framework for testing, Jasmine

Browser other questions tagged

You are not signed in. Login or sign up in order to post.