quote posts

This commit is contained in:
Moon.eth
2026-07-30 19:45:40 +09:00
parent 49c9c2ba57
commit 657d517503
22 changed files with 869 additions and 14 deletions
+21 -3
View File
@@ -1,7 +1,7 @@
import { render } from '@testing-library/svelte'
import { describe, expect, it } from 'vitest'
import { render, waitFor } from '@testing-library/svelte'
import { describe, expect, it, vi } from 'vitest'
import { APP_SERVICES } from '$lib/app-services'
import { account, session, testServices } from '$test/fixtures'
import { account, session, status, testServices } from '$test/fixtures'
import Compose from './Compose.svelte'
describe('Compose route', () => {
@@ -22,4 +22,22 @@ describe('Compose route', () => {
expect(view.getByRole('textbox', { name: 'Entry text' })).toHaveValue('@bob@example.test ')
expect(view.getByRole('combobox', { name: 'Who can see this' })).toHaveValue('direct')
})
it('loads and previews a quote target without a backend', async () => {
const fetchStatus = vi.fn().mockResolvedValue(
status({ id: 'quoted-entry', content: '<p>Loaded quote target</p>' }),
)
const services = testServices({
session: session({ token: 'token', me: account(), signedIn: true }),
endpoints: { fetchStatus },
})
const view = render(Compose, {
props: { quoteId: 'quoted-entry' },
context: new Map([[APP_SERVICES, services]]),
})
await waitFor(() => expect(fetchStatus).toHaveBeenCalledOnce())
expect(await view.findByText('Loaded quote target')).toBeInTheDocument()
expect(view.getByRole('button', { name: 'Post Quote' })).toBeEnabled()
})
})