loopback icon indicating copy to clipboard operation
loopback copied to clipboard

TypeError: TokenModel.findForRequest is not a function

Open ThatAnonyG opened this issue 3 years ago • 0 comments

Steps to reproduce

Setup the tests with Jest. Enabled token middleware authentication. Trying to call protected endpoint via supertest.

Current Behavior

When calling the endpoint from inside any test block like beforeAll or it I am getting the error "TypeError: TokenModel.findForRequest is not a function". And upon logging I see that the function is not even present.

Calling it from setup files like globalSetup or globalTeardown I do not get any such errors.

Expected Behavior

The function should be defined.

Link to reproduction sandbox

I dont know what this means.

Additional information

darwin x64 14.19.1 "loopback": "^3.9.0" "loopback-boot": "^2.6.5" "loopback-connector-mysql": "^6.1.0" "loopback-context": "^3.3.0"

Related Issues

None

ThatAnonyG avatar Jun 18 '22 09:06 ThatAnonyG