mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
a1986e098d
* feat: expose middleware utils * feat: expose middleware utils * Update antiLoop.ts * Update e2e-ci.yml
21 lines
559 B
TypeScript
21 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);
|
|
});
|