如何使用Jest测试节点js重定向

我正在用玩笑来测试我的nodejs rest API。

The problem I have currently is that when I try testing my post routes, I always receive a status code of 302 due to res.redirect("/").

我的POST路线示例:

app.post("/login", async (req, res) => {
    try {
      let username = 'example'

      ...
      return res.redirect("/");

    } catch (error) {
       return res.redirect("/");
    }
  });

开玩笑的测试文件:

'use strict';
const request = require('supertest');
const app = require('./index');
...
describe('Test', () => {

   test('POST /login', () => {
       return request(app)
             .post('/login')
             .set('username','example')
             .expect(?)

    });

});

如何测试页面已成功重定向?

另外,我还可以在登录POST路由中测试其他任何内容,即如何测试无效的用户名?