title: How to test for/mock JSON in typescript
body: <p>I have the following <code>data.ts</code>. Assuming all the setup is done with jest and all ( I'll point you to any setup errors I get if any), how do I test for/mock <code>team.json</code> in a <code>data.spec.ts</code>? I'm new to unit testing and cant find helpful step by step resources with typescript.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import { Student } from '../models';
  
  const data: Student[] = require('../data/team.json');
  
  /**
   * Returns an array of students
   *
   * @export
   * @returns {Student[]}
   */
  export function getStudentData(): Student[] {
   return data;
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>My <code>data.spec.ts</code></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const getStudentData = require('./data');
  
  test('gets students...', () =&gt; {
   // how to execute it here?
   
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Example <code>team.json</code> data</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[
    {
      "login": "jason",
      "id": 1482046,
      "site_admin": false
    },
    {
      "login": "michael",
      "id": 1819122,
      "site_admin": false
    },
    {
      "login": "arnold",
      "id": 2323810,
      "admin": true
    }
  ]</code></pre>
  </div>
  </div>
  </p>