mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-13 02:42:30 +00:00
30 lines
1018 B
TypeScript
30 lines
1018 B
TypeScript
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()
|
|
})
|
|
})
|