title: Testing Typescript with Jest, how do I test an internal function? My import/export is failing me
body: <p>I am new to Typescript and wanted to implement unit testing with Jest. 
  I installed Jest, and when I run it I receive an error, I have simplified the code for this example, and it continues to fail:</p>
  
  <pre><code>FAIL  src\__tests__\validateSender.ts 
  https validation
  ReferenceError: validateSender is not defined
  
    at Object.&lt;anonymous&gt;.test (src/__tests__/validateSender.ts:10:10)
    at process._tickCallback (internal/process/next_tick.js:109:7)
  </code></pre>
  
  <p>The test which cannot find the function (<code>./src/__tests__/validateSender.js</code>):</p>
  
  <pre><code>import {} from "jest";
  const connection = {
    encrypted: "undefined",
  };
  const req = {
    connection : ("{connection}"),
  };
  
  test("https validation", () =&gt; {
    expect(validateSender(req)).toThrow();
  });
  </code></pre>
  
  <p>the function (<code>./src/validateSender.js</code>):</p>
  
  <pre><code>function validateSender(req) {
    if (typeof req.connection.encrypted === "undefined") {
      throw new CustomException("validateSender", "connection must be secured.");
    } else { return; }
  }
  </code></pre>
  
  <p>my Jest package.json portion (<code>./package.json</code>):</p>
  
  <pre><code>"jest": {
      "transform": {
        "^.+\\.tsx?$": "&lt;rootDir&gt;/node_modules/ts-jest/preprocessor.js"
      },
      "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
      "moduleFileExtensions": [
        "ts",
        "tsx",
        "js",
        "jsx",
        "json"
      ]
    }
  </code></pre>
  
  <p>I have attempted adding an import statement for the validateSender file directly, but it fails in the same way (on <code>npm test</code> from the root directory I added <code>import {} from "./src/validateSender";</code> to the file and received the error above.)</p>
  
  <p>It was also suggested I try <code>import validateSender from "./src/validateSender";</code> but I receive <code>error TS2307: Cannot find module './src/validateSender'.</code></p>
  
  <p>It appears that I am missing some foundational knowledge for this process, but I have failed to find it in the TS handbook.</p>