Skip to content

Commit 7014f8e

Browse files
committed
fix: Storybook MemoryRouter story issues
- VideosPage story crashed on render due to missing Router context (component uses Link from react-router-dom) - ChannelManager story crashed on render due to missing Router context (component uses useNavigate); MemoryRouter was imported but unused
1 parent 8f28929 commit 7014f8e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

client/src/components/__tests__/ChannelManager.story.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ const meta: Meta<typeof ChannelManager> = {
1616
parameters: {
1717
layout: 'fullscreen',
1818
},
19+
decorators: [
20+
(Story) => (
21+
<MemoryRouter>
22+
<Story />
23+
</MemoryRouter>
24+
),
25+
],
1926
};
2027

2128
export default meta;

client/src/components/__tests__/VideosPage.story.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import type { Meta, StoryObj } from '@storybook/react';
33
import { expect, userEvent, within, waitFor } from 'storybook/test';
44
import { http, HttpResponse } from 'msw';
5+
import { MemoryRouter } from 'react-router-dom';
56
import VideosPage from '../VideosPage';
67

78
const meta: Meta<typeof VideosPage> = {
@@ -13,6 +14,13 @@ const meta: Meta<typeof VideosPage> = {
1314
parameters: {
1415
layout: 'fullscreen',
1516
},
17+
decorators: [
18+
(Story) => (
19+
<MemoryRouter>
20+
<Story />
21+
</MemoryRouter>
22+
),
23+
],
1624
};
1725

1826
export default meta;

0 commit comments

Comments
 (0)