1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/packages/middleware/test/log.spec.ts
Juan Picado 9943e2b189
refactor middleware dependencies (#3588)
* refactor middleware dependencies

* improve wrap

* chore: fix local

* chore: fix test

* changeset
2023-02-04 11:34:33 +01:00

29 lines
638 B
TypeScript

import path from 'path';
import request from 'supertest';
import { HTTP_STATUS } from '@verdaccio/core';
import { logger, 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(logger));
// @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);
});