mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-21 07:29:37 +01:00

* feat: expose middleware utils * feat: expose middleware utils * Update antiLoop.ts * Update e2e-ci.yml
22 lines
559 B
TypeScript
22 lines
559 B
TypeScript
import request from 'supertest';
|
|
|
|
import { HTTP_STATUS } from '@verdaccio/core';
|
|
|
|
import { encodeScopePackage } from '../src';
|
|
import { getApp } from './helper';
|
|
|
|
test('encode is json', async () => {
|
|
const app = getApp([]);
|
|
// @ts-ignore
|
|
app.use(encodeScopePackage);
|
|
// @ts-ignore
|
|
app.get('/:id', (req, res) => {
|
|
const { id } = req.params;
|
|
res.status(HTTP_STATUS.OK).json({ id });
|
|
});
|
|
|
|
const res = await request(app).get('/@scope/foo');
|
|
expect(res.body).toEqual({ id: '@scope/foo' });
|
|
expect(res.status).toEqual(HTTP_STATUS.OK);
|
|
});
|