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:
@@ -0,0 +1,29 @@
|
||||
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 Quotes from './Quotes.svelte'
|
||||
|
||||
describe('Quotes route', () => {
|
||||
it('shows the source and paginated quoting entries', async () => {
|
||||
const services = testServices({
|
||||
session: session(),
|
||||
endpoints: {
|
||||
fetchStatus: vi.fn().mockResolvedValue(
|
||||
status({ id: 'source', content: '<p>Original entry</p>' }),
|
||||
),
|
||||
fetchQuotes: vi.fn().mockResolvedValue({
|
||||
items: [status({ id: 'quote-1', content: '<p>A quoting entry</p>' })],
|
||||
links: {},
|
||||
}),
|
||||
},
|
||||
})
|
||||
const view = render(Quotes, {
|
||||
props: { id: 'source' },
|
||||
context: new Map([[APP_SERVICES, services]]),
|
||||
})
|
||||
|
||||
expect(await view.findByText('Original entry')).toBeInTheDocument()
|
||||
expect(await view.findByText('A quoting entry')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user