mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-13 02:42:30 +00:00
support flash
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
fetchQuotes,
|
||||
postStatus,
|
||||
setEmojiReaction,
|
||||
uploadMedia,
|
||||
updateProfileFields,
|
||||
updatePublicProfile,
|
||||
votePoll,
|
||||
@@ -97,6 +98,39 @@ describe('updatePublicProfile', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('media uploads', () => {
|
||||
it('preserves an SWF file and its MIME type in the multipart upload', async () => {
|
||||
const swf = new File(['flash bytes'], 'animation.swf', {
|
||||
type: 'application/x-shockwave-flash',
|
||||
})
|
||||
const fetchMock = vi.fn(async (_url: string, init?: RequestInit) => {
|
||||
const form = init?.body as FormData
|
||||
expect(init?.method).toBe('POST')
|
||||
expect(form.get('file')).toBe(swf)
|
||||
expect((form.get('file') as File).name).toBe('animation.swf')
|
||||
expect((form.get('file') as File).type).toBe('application/x-shockwave-flash')
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
id: 'flash-1',
|
||||
type: 'unknown',
|
||||
url: 'https://media.example.test/animation.swf',
|
||||
preview_url: null,
|
||||
pleroma: { mime_type: 'application/x-shockwave-flash' },
|
||||
}),
|
||||
{ status: 200, headers: { 'Content-Type': 'application/json' } },
|
||||
)
|
||||
})
|
||||
vi.stubGlobal('fetch', fetchMock)
|
||||
|
||||
await uploadMedia(new ApiClient('example.test', 'token'), swf)
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledWith(
|
||||
'https://example.test/api/v1/media',
|
||||
expect.any(Object),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('poll endpoints', () => {
|
||||
it('submits selected poll option indexes as JSON', async () => {
|
||||
const fetchMock = vi.fn(async (_url: string, init?: RequestInit) => {
|
||||
|
||||
Reference in New Issue
Block a user