title: Jest: How to test function that returns a function
body: <p>I have several functions I would like to test with Jest. All functions are functions that return functions. </p>
  
  <p>A simple example:</p>
  
  <pre><code>export function csl(foo) {
    return function(bar) {
        return(bar)
       };
  }
  </code></pre>
  
  <p>now I want to test if the input = the return is. I try it with:</p>
  
  <pre><code>  expect(() =&gt; csl("foo")).toBe("foo") // = received: [Function anonymous]
  
    expect(csl("foo")).toBe("foo") // = received: undefined
  </code></pre>
  
  <p>How I can test these functions?</p>