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: '
Fetched shallow quote
' }), ) 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') }) })