How to mock c.get in unit test #2026
duncanhunter
started this conversation in
General
Replies: 1 comment
-
I have been able to mock the middleware as per below example. mocks.authenticate.mockImplementation((c: Context, next: Next) => {
c.set("auth", {name: 'test name'});
return next();
}); I am unblocked but still interested to know how to pass context to an app.request(path) with the auth set already. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My endpoint relies on some auth details set with c.set('auth', auth) in middleware.
Is it possible to mock c.get('auth') in a unit test. I am using vitest.
Beta Was this translation helpful? Give feedback.
All reactions