35a572c037
The list showed the status but only the editor could change it. Each row now carries the next sensible step and names the blockers when publishing is not possible. Also real umlauts in the API texts.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { renderToStaticMarkup } from 'react-dom/server'
|
|
import type { PostStatus } from '~/domain/types'
|
|
|
|
vi.mock('next-intl', () => ({
|
|
useTranslations: () => (key: string) => key,
|
|
}))
|
|
|
|
vi.mock('~/lib/entry-actions', () => ({
|
|
archiveEntry: vi.fn(),
|
|
publishEntry: vi.fn(),
|
|
resumeEntry: vi.fn(),
|
|
unscheduleEntry: vi.fn(),
|
|
}))
|
|
|
|
const { EntryStatusControl } = await import('~/components/admin/EntryStatusControl')
|
|
|
|
function render(status: PostStatus): string {
|
|
return renderToStaticMarkup(<EntryStatusControl id="e1f7f2f0-0000-4000-8000-000000000001" status={status} />)
|
|
}
|
|
|
|
describe('EntryStatusControl', () => {
|
|
it('bietet zu jedem Status den passenden Schritt an', () => {
|
|
expect(render('draft')).toContain('actions.publish')
|
|
expect(render('scheduled')).toContain('actions.unschedule')
|
|
expect(render('published')).toContain('actions.archive')
|
|
expect(render('archived')).toContain('actions.resume')
|
|
})
|
|
|
|
it('zeigt den Status immer als Marke', () => {
|
|
expect(render('draft')).toContain('status.draft')
|
|
expect(render('published')).toContain('status.published')
|
|
})
|
|
})
|