0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/packages/middleware/test/log.spec.ts
Juan Picado a1986e098d
feat: expose middleware utils (#3580)
* feat: expose middleware utils

* feat: expose middleware utils

* Update antiLoop.ts

* Update e2e-ci.yml
2023-01-29 15:08:50 +01:00

28 lines
622 B
TypeScript

import path from 'path';
import request from 'supertest';
import { HTTP_STATUS } from '@verdaccio/core';
import { setup } from '@verdaccio/logger';
import { log } from '../src';
import { getApp } from './helper';
setup({
type: 'file',
path: path.join(__dirname, './verdaccio.log'),
level: 'trace',
format: 'json',
});
test('should log request', async () => {
const app = getApp([]);
// @ts-ignore
app.use(log);
// @ts-ignore
app.get('/:package', (req, res) => {
res.status(HTTP_STATUS.OK).json({});
});
// TODO: pending output
return request(app).get('/react').expect(HTTP_STATUS.OK);
});