mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-13 02:42:30 +00:00
quote posts
This commit is contained in:
@@ -25,6 +25,31 @@ describe('Composer', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('can submit a structured quote without commentary', async () => {
|
||||
const quoted = status({
|
||||
id: 'quoted-entry',
|
||||
content: '<p>The original thought</p>',
|
||||
})
|
||||
const postStatus = vi.fn().mockResolvedValue(status({ id: 'new-quote' }))
|
||||
const services = testServices({
|
||||
session: session({ token: 'token', me: account(), signedIn: true }),
|
||||
endpoints: { postStatus },
|
||||
})
|
||||
const view = render(Composer, {
|
||||
props: { quote: quoted, submitLabel: 'Post Quote' },
|
||||
context: new Map([[APP_SERVICES, services]]),
|
||||
})
|
||||
|
||||
expect(view.getByText('The original thought')).toBeInTheDocument()
|
||||
await fireEvent.click(view.getByRole('button', { name: 'Post Quote' }))
|
||||
|
||||
await waitFor(() => expect(postStatus).toHaveBeenCalledOnce())
|
||||
expect(postStatus.mock.calls[0][1]).toMatchObject({
|
||||
status: '',
|
||||
quoted_status_id: 'quoted-entry',
|
||||
})
|
||||
})
|
||||
|
||||
it('composes a multiple-choice poll without a backend', async () => {
|
||||
const postStatus = vi.fn().mockResolvedValue(status())
|
||||
const services = testServices({
|
||||
|
||||
Reference in New Issue
Block a user