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:
Gabe Kangas
2025-10-20 21:26:32 -07:00
committed by GitHub
parent 72d5ee8754
commit cc9286416c
68 changed files with 40881 additions and 44059 deletions
@@ -1,24 +1,9 @@
import { StoryFn, Meta } from '@storybook/react';
import { StoryFn, Meta } from '@storybook/nextjs';
import { RecoilRoot } from 'recoil';
import { action } from '@storybook/addon-actions';
import { http, HttpResponse } from 'msw';
import { FollowerCollection } from './FollowerCollection';
const mocks = {
mocks: [
{
// The "matcher" determines if this
// mock should respond to the current
// call to fetch().
matcher: {
name: 'response',
url: 'glob:/api/followers*',
},
// If the "matcher" matches the current
// fetch() call, the fetch response is
// built using this "response".
response: {
status: 200,
body: {
const mockFollowersData = {
total: 100,
results: [
{
@@ -227,34 +212,11 @@ const mocks = {
disabledAt: null,
},
],
},
},
},
],
};
};
const noFollowersMock = {
mocks: [
{
// The "matcher" determines if this
// mock should respond to the current
// call to fetch().
matcher: {
name: 'response',
url: 'glob:/api/followers*',
},
// If the "matcher" matches the current
// fetch() call, the fetch response is
// built using this "response".
response: {
status: 200,
body: {
total: 0,
results: [],
},
},
},
],
const noFollowersData = {
total: 0,
results: [],
};
const meta = {
@@ -270,9 +232,7 @@ export default meta;
const Template: StoryFn<typeof FollowerCollection> = (args: object) => (
<RecoilRoot>
<FollowerCollection
onFollowButtonClick={() => {
action('Follow button clicked');
}}
onFollowButtonClick={() => {}}
name="Example stream name"
{...args}
/>
@@ -283,7 +243,13 @@ export const NoFollowers = {
render: Template,
parameters: {
fetchMock: noFollowersMock,
msw: {
handlers: [
http.get('/api/followers*', () => {
return HttpResponse.json(noFollowersData);
}),
],
},
},
};
@@ -291,6 +257,12 @@ export const Example = {
render: Template,
parameters: {
fetchMock: mocks,
msw: {
handlers: [
http.get('/api/followers*', () => {
return HttpResponse.json(mockFollowersData);
}),
],
},
},
};