mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-14 03:02:31 +00:00
quote posts
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { render } from '@testing-library/svelte'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { APP_SERVICES } from '$lib/app-services'
|
||||
import { session, status, testServices } from '$test/fixtures'
|
||||
import QuoteCard from './QuoteCard.svelte'
|
||||
|
||||
describe('QuoteCard', () => {
|
||||
it('loads a Mastodon shallow quote by its status ID', async () => {
|
||||
const fetchStatus = vi.fn().mockResolvedValue(
|
||||
status({ id: 'shallow-target', content: '<p>Fetched shallow quote</p>' }),
|
||||
)
|
||||
const services = testServices({
|
||||
session: session(),
|
||||
endpoints: { fetchStatus },
|
||||
})
|
||||
const view = render(QuoteCard, {
|
||||
props: {
|
||||
quote: {
|
||||
state: 'accepted',
|
||||
status: null,
|
||||
id: 'shallow-target',
|
||||
url: null,
|
||||
},
|
||||
},
|
||||
context: new Map([[APP_SERVICES, services]]),
|
||||
})
|
||||
|
||||
expect(await view.findByText('Fetched shallow quote')).toBeInTheDocument()
|
||||
expect(fetchStatus).toHaveBeenCalledWith(services.session.api, 'shallow-target')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user