test(frontend): migrate MSW in Storybook to v2 (#13195)

This commit is contained in:
zyoshoka 2024-02-08 13:28:49 +09:00 committed by GitHub
parent 82c34f7f45
commit 5299d17060
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 140 additions and 143 deletions

View file

@ -5,7 +5,7 @@
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { StoryObj } from '@storybook/vue3';
import { rest } from 'msw';
import { HttpResponse, http } from 'msw';
import { userDetailed, inviteCode } from '../../.storybook/fakes.js';
import { commonHandlers } from '../../.storybook/mocks.js';
import MkInviteCode from './MkInviteCode.vue';
@ -39,8 +39,8 @@ export const Default = {
msw: {
handlers: [
...commonHandlers,
rest.post('/api/users/show', (req, res, ctx) => {
return res(ctx.json(userDetailed(req.params.userId as string)));
http.post('/api/users/show', ({ params }) => {
return HttpResponse.json(userDetailed(params.userId as string));
}),
],
},