1
This commit is contained in:
@@ -4,6 +4,7 @@ export {
|
||||
getRpgEntryWorldLibraryDetail,
|
||||
listRpgEntryWorldGallery,
|
||||
listRpgEntryWorldLibrary,
|
||||
likeRpgEntryWorldGallery,
|
||||
publishRpgEntryWorldProfile,
|
||||
recordRpgEntryWorldGalleryPlay,
|
||||
remixRpgEntryWorldGallery,
|
||||
|
||||
@@ -152,6 +152,26 @@ describe('rpgEntry public custom world gallery routes', () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('likes public gallery detail through the authenticated mutation route', async () => {
|
||||
requestJsonMock.mockResolvedValueOnce({
|
||||
entry: {
|
||||
ownerUserId: 'user-1',
|
||||
profileId: 'profile-1',
|
||||
likeCount: 2,
|
||||
},
|
||||
});
|
||||
|
||||
const { likeRpgEntryWorldGallery } = await import('./rpgEntryLibraryClient');
|
||||
await likeRpgEntryWorldGallery('user-1', 'profile-1');
|
||||
|
||||
expect(requestJsonMock).toHaveBeenCalledWith(
|
||||
'/api/runtime/custom-world-gallery/user-1/profile-1/like',
|
||||
expect.objectContaining({ method: 'POST' }),
|
||||
'点赞作品失败',
|
||||
expect.anything(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('rpgEntry save archive routes', () => {
|
||||
|
||||
@@ -115,6 +115,23 @@ export async function recordRpgEntryWorldGalleryPlay(
|
||||
return response.entry;
|
||||
}
|
||||
|
||||
export async function likeRpgEntryWorldGallery(
|
||||
ownerUserId: string,
|
||||
profileId: string,
|
||||
options: RuntimeRequestOptions = {},
|
||||
) {
|
||||
const response = await requestRpgRuntimeJson<
|
||||
CustomWorldGalleryDetailResponse<CustomWorldProfile>
|
||||
>(
|
||||
`/custom-world-gallery/${encodeURIComponent(ownerUserId)}/${encodeURIComponent(profileId)}/like`,
|
||||
{ method: 'POST' },
|
||||
'点赞作品失败',
|
||||
options,
|
||||
);
|
||||
|
||||
return response.entry;
|
||||
}
|
||||
|
||||
export async function getRpgEntryWorldLibraryDetail(
|
||||
profileId: string,
|
||||
options: RuntimeRequestOptions = {},
|
||||
@@ -218,6 +235,7 @@ export const rpgEntryLibraryClient = {
|
||||
getWorldLibraryDetail: getRpgEntryWorldLibraryDetail,
|
||||
remixWorldGallery: remixRpgEntryWorldGallery,
|
||||
recordWorldGalleryPlay: recordRpgEntryWorldGalleryPlay,
|
||||
likeWorldGallery: likeRpgEntryWorldGallery,
|
||||
upsertWorldProfile: upsertRpgEntryWorldProfile,
|
||||
deleteWorldProfile: deleteRpgEntryWorldProfile,
|
||||
publishWorldProfile: publishRpgEntryWorldProfile,
|
||||
|
||||
Reference in New Issue
Block a user