title: How to test with hardwired function
body: <p>My understanding is that code should be written without testing in mind, and that testing needs to bend to cater to the code. My problem is that I have a function <code>f1</code> that calls out for input data (a  Haskell <code>data</code> type) that is returned from another function <code>f2</code>. So how can I write a test case that provides <strong>different</strong> input data?</p>
  <p>Of course I could add an arg to <code>f1</code> for the input, but after all that is catering to testing. It's actually messier than that, because <code>f1</code> is actually a <a href="https://iohk.io/en/blog/posts/2021/04/13/plutus-what-you-need-to-know/" rel="nofollow noreferrer">Plutus contract</a>, and the arg would need to be serialized to JSON -- all for the sake of testing. Alternatively, I could read the input from a file, and provide the filepath as an arg -- the arg is bad enough, but I don't want to go with a file if I don't have to.</p>
  <p><strong>Note that <code>f1</code> is an http endpoint, and all testing code needs to go through an endpoint(s).</strong></p>
  <pre class="lang-hs prettyprint-override"><code>data ActualData = ActualData String String Integer
  newtype Input = Input [ActualData]
  
  f1:: Contract () Schema Text () 
  f1 = do
      let input = f2 
      ...
  
  f2 :: Input -- to be determined in the future, currently unknown
  f2 = Input
      [ ActualData &quot;BlackRock&quot; &quot;pkh1&quot; 10
      , ActualData &quot;GreenRock&quot; &quot;pkh2&quot; 20
      ]
  </code></pre>