0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/packages/plugins/ui-theme/jest/server-handlers.ts
Juan Picado 0481b9a329
feat: upgrade react 18 (#3495)
* chore: update react 18

* Create four-ways-try.md

* Update signin.cy.ts

* chore: new ci

* Update e2e-ui.yml

* Update e2e-ui.yml

* ci

* ci

* ci

* Update e2e-ui.yml

* Update e2e-ui.yml

* chore: fix ui test

* Update publish.cy.ts

* chore: update tests

* add strict mode
2022-11-12 22:05:08 +01:00

27 lines
689 B
TypeScript

import { rest } from 'msw';
const packagesPayload = require('./api/packages.json');
export const handlers = [
rest.get('http://localhost:9000/-/verdaccio/data/packages', (req, res, ctx) => {
return res(ctx.json(packagesPayload));
}),
rest.post<{ username: string; password: string }, { token: string; username: string }>(
'http://localhost:9000/-/verdaccio/sec/login',
// @ts-ignore
async (req, res, ctx) => {
const body = await req.json();
if (body.username === 'fail') {
return ctx.status(401);
}
return res(
ctx.json({
username: body.username,
token: 'valid token',
})
);
}
),
];