Reviewed-on: #355 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
このコミットはPull リクエスト #355 でマージされました.
このコミットが含まれているのは:
@@ -10,6 +10,7 @@ const postsApi = vi.hoisted (() => ({
|
||||
}))
|
||||
|
||||
const tagsApi = vi.hoisted (() => ({
|
||||
fetchNicoTags: vi.fn (),
|
||||
fetchTag: vi.fn (),
|
||||
fetchTagByName: vi.fn (),
|
||||
fetchTagChanges: vi.fn (),
|
||||
@@ -37,6 +38,7 @@ describe ('prefetchForURL', () => {
|
||||
postsApi.fetchPost.mockResolvedValue ({ id: 1 })
|
||||
postsApi.fetchPostChanges.mockResolvedValue ({ versions: [], count: 0 })
|
||||
tagsApi.fetchTags.mockResolvedValue ({ tags: [], count: 0 })
|
||||
tagsApi.fetchNicoTags.mockResolvedValue ({ tags: [], count: 0 })
|
||||
tagsApi.fetchTag.mockResolvedValue ({ id: 1 })
|
||||
tagsApi.fetchTagByName.mockResolvedValue (null)
|
||||
tagsApi.fetchTagChanges.mockResolvedValue ({ versions: [], count: 0 })
|
||||
@@ -85,6 +87,32 @@ describe ('prefetchForURL', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it ('prefetches nico tag indexes and their alias from query parameters', async () => {
|
||||
await prefetchForURL (
|
||||
qc (),
|
||||
'http://localhost/tags/nico?name=source&linked_tag=destination'
|
||||
+ '&link_status=linked&page=3&limit=10',
|
||||
)
|
||||
await prefetchForURL (qc (), 'http://localhost/nico/tags?page=2')
|
||||
|
||||
expect (tagsApi.fetchNicoTags).toHaveBeenNthCalledWith (1, {
|
||||
name: 'source',
|
||||
linkedTag: 'destination',
|
||||
linkStatus: 'linked',
|
||||
page: 3,
|
||||
limit: 10,
|
||||
order: 'updated_at:desc',
|
||||
})
|
||||
expect (tagsApi.fetchNicoTags).toHaveBeenNthCalledWith (2, {
|
||||
name: '',
|
||||
linkedTag: '',
|
||||
linkStatus: 'all',
|
||||
page: 2,
|
||||
limit: 20,
|
||||
order: 'updated_at:desc',
|
||||
})
|
||||
})
|
||||
|
||||
it ('prefetches wiki show pages and related tag/post data', async () => {
|
||||
wikiApi.fetchWikiPageByTitle.mockResolvedValueOnce ({
|
||||
id: 3,
|
||||
|
||||
新しい課題から参照
ユーザをブロックする