diff options
| author | Acid Chicken (硫酸鶏) <root@acid-chicken.com> | 2023-04-09 13:16:56 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-09 04:16:56 +0000 |
| commit | 2b19e1f7326e61ab53b85c4f155b189ee32d79d7 (patch) | |
| tree | 64f16a3ebd7a270a74e3f5acb42ef6a44a66d1c7 /packages/frontend/src | |
| parent | fix(backend): 連合しているインスタンスについて予期せず配... (diff) | |
| download | misskey-2b19e1f7326e61ab53b85c4f155b189ee32d79d7.tar.gz misskey-2b19e1f7326e61ab53b85c4f155b189ee32d79d7.tar.bz2 misskey-2b19e1f7326e61ab53b85c4f155b189ee32d79d7.zip | |
test: add `/@:acct` stories (#10517)
* test: add `/@:acct` stories
* test: add mocks
Diffstat (limited to 'packages/frontend/src')
| -rw-r--r-- | packages/frontend/src/pages/user/home.stories.impl.ts | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/packages/frontend/src/pages/user/home.stories.impl.ts b/packages/frontend/src/pages/user/home.stories.impl.ts new file mode 100644 index 0000000000..50da0c6991 --- /dev/null +++ b/packages/frontend/src/pages/user/home.stories.impl.ts @@ -0,0 +1,74 @@ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ +import { StoryObj } from '@storybook/vue3'; +import { rest } from 'msw'; +import { userDetailed } from '../../../.storybook/fakes'; +import { commonHandlers } from '../../../.storybook/mocks'; +import home_ from './home.vue'; +export const Default = { + render(args) { + return { + components: { + home_, + }, + setup() { + return { + args, + }; + }, + computed: { + props() { + return { + ...this.args, + }; + }, + }, + template: '<home_ v-bind="props" />', + }; + }, + args: { + user: userDetailed(), + disableNotes: false, + }, + parameters: { + layout: 'fullscreen', + msw: { + handlers: [ + ...commonHandlers, + rest.post('/api/users/notes', (req, res, ctx) => { + return res(ctx.json([])); + }), + rest.get('/api/charts/user/notes', (req, res, ctx) => { + const length = Math.max(Math.min(parseInt(req.url.searchParams.get('limit') ?? '30', 10), 1), 300); + return res(ctx.json({ + total: Array.from({ length }, () => 0), + inc: Array.from({ length }, () => 0), + dec: Array.from({ length }, () => 0), + diffs: { + normal: Array.from({ length }, () => 0), + reply: Array.from({ length }, () => 0), + renote: Array.from({ length }, () => 0), + withFile: Array.from({ length }, () => 0), + }, + })); + }), + rest.get('/api/charts/user/pv', (req, res, ctx) => { + const length = Math.max(Math.min(parseInt(req.url.searchParams.get('limit') ?? '30', 10), 1), 300); + return res(ctx.json({ + upv: { + user: Array.from({ length }, () => 0), + visitor: Array.from({ length }, () => 0), + }, + pv: { + user: Array.from({ length }, () => 0), + visitor: Array.from({ length }, () => 0), + }, + })); + }), + ], + }, + chromatic: { + // `XActivity` is not compatible with Chromatic for now + disableSnapshot: true, + }, + }, +} satisfies StoryObj<typeof home_>; |