title: Unit Test [Jasmin] how to cover function with find method and indexOf?
body: <p>I need help with cover function on jasmine. I have an array, an array can contain many objects</p>
  <pre><code> const providers =[
      {
         countries: [&quot;GB&quot;],
         network: &quot;Test GB&quot;,
         link: &quot;https://test.com&quot;
      },
  ]
  </code></pre>
  <p>I have a function myFunc..</p>
  <pre><code>myFunc: function () {
     var country = this.userCountry;
        this.provider = providers.find(function(provider) {
            return provider.countries.indexOf(userCountry) &gt; -1;
        }) || this.config.watchButton.defaultProvider;
  }
  </code></pre>
  <p>Also i wrote some unit test, but without some</p>
  <pre><code> describe(&quot;[TEST] smyFunc method...&quot;, function () {
          var country;
  
          beforeEach(function () {
              spyOn(baseMethods, 'setProviderData');
  
              baseMethods.config = {
                  watchButton: {
                      provider: {
                          countries: [&quot;GB&quot;],
                          network: &quot;Test GB&quot;,
                          link: &quot;https://test.com&quot;
                      },
  
                      default: {
                          network: &quot;Test default&quot;,
                          link: &quot;https://default.com&quot;
                      }
                  }
              };
          });
  
          it('[TEST] If country expist in provider.', function () {
              country = 'GB';
              baseMethods.myFunc();
              expect($.fn.provider, 'find').toBe(provider);
          });
      });
  </code></pre>
  <p>How should I write a test with the find and indexOf methods for tests? I will be grateful for any advice</p>