mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-13 02:42:30 +00:00
reacts and custom emoji reacts
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user