1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 05:45:22 +02:00

chore(deps): upgrade to msw v2 [EE-6489] (#10911)

This commit is contained in:
Chaim Lev-Ari 2024-01-04 16:57:21 +07:00 committed by GitHub
parent ecd603db8c
commit 400a80c07d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 2602 additions and 1669 deletions

View file

@ -1,6 +1,6 @@
import { Meta } from '@storybook/react';
import { Form, Formik } from 'formik';
import { rest } from 'msw';
import { http, HttpResponse } from 'msw';
import { withUserProvider } from '@/react/test-utils/withUserProvider';
import { GitCredential } from '@/react/portainer/account/git-credentials/types';
@ -14,28 +14,25 @@ export default {
parameters: {
msw: {
handlers: [
rest.get<Array<GitCredential>, { userId: string }>(
http.get<{ userId: string }, Array<GitCredential>>(
'/api/users/:userId/gitcredentials',
(req, res, ctx) =>
res(
ctx.status(200),
ctx.json<Array<GitCredential>>([
{
id: 1,
name: 'credential-1',
username: 'username-1',
userId: parseInt(req.params.userId, 10),
creationDate: 0,
},
{
id: 2,
name: 'credential-2',
username: 'username-2',
userId: parseInt(req.params.userId, 10),
creationDate: 0,
},
])
)
({ params }) =>
HttpResponse.json([
{
id: 1,
name: 'credential-1',
username: 'username-1',
userId: parseInt(params.userId, 10),
creationDate: 0,
},
{
id: 2,
name: 'credential-2',
username: 'username-2',
userId: parseInt(params.userId, 10),
creationDate: 0,
},
])
),
],
},