All files / src/lib/middleware no-authentication.ts

100% Statements 6/6
50% Branches 1/2
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  62x       131x   648x   628x   648x     62x  
import { Application } from 'express';
import NoAuthUser from '../types/no-auth-user';
 
// eslint-disable-next-line
function noneAuthentication(basePath = '', app: Application): void {
    app.use(`${basePath}/api/admin/`, (req, res, next) => {
        // @ts-ignore
        if (!req.user) {
            // @ts-expect-error
            req.user = new NoAuthUser();
        }
        next();
    });
}
export default noneAuthentication;