Using loopback v3 with jest and supertest. We are using the token middleware for authorization. In setup and teardown it works properly but when test cases are ran the middleware errors out with "Token.findForRequest is not a function". I tried logging it from the setup/teardown and it is a function but when I log it from tests it shows undefined.
This is how I am setting up supertest.
const request = require('supertest')(require('../../../server/server'));
// tests or setup/teardown code