Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Releases: HugoDF/mock-express-request-response

Setup simple authentication application

17 Feb 19:16
Compare
Choose a tag to compare
implement client-sessions-based (cookie) authentication app + sample …

…requests

Mock/stub Express request/response

17 Feb 19:17
Compare
Choose a tag to compare
mock-request-response

add mock request/response with jest and sinon

Tests for a middleware that consumes headers

17 Feb 19:58
Compare
Choose a tag to compare

Adds tests for headerAuthMiddleware.

An example of testing a middleware and of mocking .get('header-name') on Express requests.

logout tests

17 Feb 19:21
Compare
Choose a tag to compare

Adds tests for logout route handler.

Route resets contents of req.session.data and 200s. Example of testing a write to a field on req (or res)

login tests

17 Feb 19:23
Compare
Choose a tag to compare

Adds tests for login route handler.

Adds a body param for mockRequest since login reads from the body (which is actually provided by the body-parser middleware).

checkAuth tests

17 Feb 19:17
Compare
Choose a tag to compare

Adds tests for checkAuth route handler using previously defined mockRequest and mockResponse.

The route just reads from res.session.data and depending on the contents of the session, 401s (session is empty/invalid) or 200s with part of the contents of it.