title: Unit-Testing a filter with Jasmine in AngularJS
body: <p>I don't know how to unit testing my filters. One of the examples are shown below:</p>
  
  <pre><code>angular.module('testApp')
      .filter('range', ['$log', function ($log) {
      return function (companylist, min, max) {
          max = parseInt(max, 10) || 100;
          var result = [];
          angular.forEach(companylist, function (val) {
              if (val.maxSpread &gt;= min &amp;&amp; val.maxSpread &lt;= max) {
                  result.push(val);
              }
          });
  
          return result;
      }
  }]);
  </code></pre>
  
  <p>How you can see the filter iterates an array <code>companylist</code> and if the max value will changed the result returns a new list of company.</p>
  
  <p>The company object is structured as follows:</p>
  
  <pre><code>{
    Id: 1,
    name: 'CompanyName',
    short: 'CN',
    maxSpread: 25
  }
  </code></pre>
  
  <p>I have no idea to test this filter. Looking for a unit test at several tutorials and blogs but I've not found anything what could help me.</p>