forked from misskey-dev/misskey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add
/@:acct
stories (misskey-dev#10517)
* test: add `/@:acct` stories * test: add mocks
- Loading branch information
1 parent
8b1362a
commit 01b9df8
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_>; |