title: Jest test is not passing through any parameters (becomes 'undefined')
body: <p><strong>EDIT:</strong> The variable <code>username</code> becomes <code>undefined</code> for some reason. I tried passing other variables too, but none of them appear as they should with <code>console.log()</code>.</p>
  
  <p>I have a jest file <em>("index.test.js")</em> for testing my API:</p>
  
  <pre><code>'use strict';
  
  const request = require('supertest');
  const app = require('./index');
  
  describe('Test login', () =&gt; {
    test('POST /login', () =&gt; {
          return request(app)
               .post('/login')
               .send({username: 'preset1'})  //suggestion by @acincognito
               .expect(301)
  
      });
  
  });
  </code></pre>
  
  <p>and a corresponding POST route in my nodejs file <em>("index.js")</em>:</p>
  
  <pre><code>...
  
  function contains(arr, key, val) {
      for (var i = 0; i &lt; arr.length; i++) {
          if(arr[i][key] === val) {
              return true
          }; 
      }
      return false;
  }
  
  app.post("/login", async (req, res) =&gt; {
      try {
        var username = req.body.username;
        const data = await readFile("results.json");
        var json = JSON.parse(data);
        if (contains(json, "name", username) === true){
  
           ...
  
           return res.redirect(301,"/");
         } else {
           return res.redirect(401,"/");
         }
      } catch (error) {
          return res.redirect("/");
      }
  });
  
  </code></pre>
  
  <p>JSON file <em>("results.json")</em> has the following format:</p>
  
  <pre><code>[
    {"name":"preset1","otherstuff":[]},
    ...
    {"name":"preset5","otherstuff":[]}
  ]
  </code></pre>
  
  <p>I am getting the error message :</p>
  
  <p><code>expected 301 "Moved Permanently", got 401 "Unauthorized"</code></p>
  
  <p><strong>NOTE:</strong> When I run the code manually on a local server, everything works as it should which seems to contradict the output of the test.</p>