title: Sinon: Test function return value
body: <p>I am using <code>Sinon</code> <code>Enzyme</code> for testing. I have a function that takes an array of objects and transform it into a new different array. </p>
  
  <pre><code>getContainersByHostId(data) {
      return _.chain(data)
        .groupBy('hostId')
        .toPairs()
        .map(currentItem =&gt; _.zipObject(['hostId', 'containers'], currentItem))
        .value();
    }
  </code></pre>
  
  <p><strong>Args:</strong></p>
  
  <pre><code>const containers = [{
            id: 'c_01',
            hostId: 'h_01',
            hostIp: '192.168.1.0',
            name: 'Some Container'
          }];
  </code></pre>
  
  <p><strong>Result:</strong></p>
  
  <pre><code>[{hostId: 'h_01',
  containers: [{
  hostId: 'h_01',
  ip: '192.168.1.0',
  id: 'c_01',
  name: 'Some Container'
  }]}];
  </code></pre>
  
  <p>This works fine. However, the issue I am facing is in the unit test. So currently I have this.</p>
  
  <pre><code>const containers = [{
            id: 'c_01',
            hostId: 'h_01',
            hostIp: '192.168.1.0',
            name: 'Indigo Container'
          }];
  
          const wrapper = shallow(&lt;Groups {...props} /&gt;);
          const instance = wrapper.instance();
          sandbox.stub(instance, 'getContainersByHostId');
          instance.getContainersByHostId(containers);
          expect(instance.getContainersByHostId.calledWith(containers)).to.equal(true);
        });
  </code></pre>
  
  <p>How to test if the args that are passed equal to new array?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I have tried <code>returnValue</code> but it gives me false and I couldn't find any possible solution to check what it's really returning.</p>