reacts and custom emoji reacts

This commit is contained in:
Moon.eth
2026-07-30 17:38:23 +09:00
parent 5b7b4360d2
commit b814d79f19
7 changed files with 384 additions and 3 deletions
+29
View File
@@ -3,6 +3,7 @@ import { ApiClient } from './client'
import {
fetchNotifications,
postStatus,
setEmojiReaction,
updateProfileFields,
updatePublicProfile,
votePoll,
@@ -152,6 +153,34 @@ describe('poll endpoints', () => {
})
})
describe('emoji reaction endpoints', () => {
it.each([
[true, 'PUT'],
[false, 'DELETE'],
] as const)('uses the Pleroma/Akkoma reaction endpoint (on=%s)', async (on, method) => {
const fetchMock = vi.fn(async (_url: string, init?: RequestInit) => {
expect(init?.method).toBe(method)
return new Response(JSON.stringify({ id: 'status/one' }), {
status: 200,
headers: { 'Content-Type': 'application/json' },
})
})
vi.stubGlobal('fetch', fetchMock)
await setEmojiReaction(
new ApiClient('example.test', 'token'),
'status/one',
'party_blob@remote.example',
on,
)
expect(fetchMock).toHaveBeenCalledWith(
'https://example.test/api/v1/pleroma/statuses/status%2Fone/reactions/party_blob%40remote.example',
expect.any(Object),
)
})
})
describe('fetchNotifications', () => {
it('defensively applies requested types when a server ignores the filter', async () => {
vi.stubGlobal(