Update storybook to v9 (#4645)
* chore: Update storybook to v9 * Pin next-export-i18n + remove outdated mock library * Replace old mocking library with MSW * Resolve knip unused code warnings
This commit is contained in:
+11
-23
@@ -1,23 +1,9 @@
|
||||
import { StoryFn, Meta } from '@storybook/react';
|
||||
import { StoryFn, Meta } from '@storybook/nextjs';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
import { ChatModerationDetailsModal } from './ChatModerationDetailsModal';
|
||||
|
||||
const mocks = {
|
||||
mocks: [
|
||||
{
|
||||
// The "matcher" determines if this
|
||||
// mock should respond to the current
|
||||
// call to fetch().
|
||||
matcher: {
|
||||
name: 'response',
|
||||
url: 'glob:/api/moderation/chat/user/*',
|
||||
},
|
||||
// If the "matcher" matches the current
|
||||
// fetch() call, the fetch response is
|
||||
// built using this "response".
|
||||
response: {
|
||||
status: 200,
|
||||
body: {
|
||||
const mockUserData = {
|
||||
user: {
|
||||
id: 'hjFPU967R',
|
||||
displayName: 'focused-snyder',
|
||||
@@ -57,17 +43,19 @@ const mocks = {
|
||||
body: 'test message 1',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
const meta = {
|
||||
title: 'owncast/Chat/Moderation modal',
|
||||
component: ChatModerationDetailsModal,
|
||||
parameters: {
|
||||
fetchMock: mocks,
|
||||
msw: {
|
||||
handlers: [
|
||||
http.get('/api/moderation/chat/user/*', () => {
|
||||
return HttpResponse.json(mockUserData);
|
||||
}),
|
||||
],
|
||||
},
|
||||
docs: {
|
||||
description: {
|
||||
component: `This should be a modal that gives the moderator more details about the user such as:
|
||||
|
||||
Reference in New Issue
Block a user