Add Logbuch: project update blog with admin, media and API
Public archive with sidebar navigation, project pages, month archive, search and entry pages with image blocks. Admin area for brands, projects, post types, users, api clients, media and the entry editor with drag and drop images, preview per audience, scheduling and publish checks. Read and write API with bearer tokens, audience scoping, idempotent creation, OpenAPI document and editorial guide. Magic link login with configurable allowed domains, whole app behind the session gate. 456 tests including design rule checks.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { checkPublish } from '~/domain/publish-checks'
|
||||
|
||||
const base = {
|
||||
title: 'Regel-Engine: Bedingung trifft Aktion',
|
||||
audience: 'internal' as const,
|
||||
blockCount: 3,
|
||||
images: [{ hasAlt: true }],
|
||||
tagCount: 1,
|
||||
hasCover: true,
|
||||
}
|
||||
|
||||
describe('checkPublish', () => {
|
||||
it('lässt einen vollständigen Beitrag ohne Sperre und ohne Hinweis durch', () => {
|
||||
expect(checkPublish(base)).toEqual({ blockers: [], hints: [] })
|
||||
})
|
||||
|
||||
it('sperrt einen Beitrag ohne Titel', () => {
|
||||
expect(checkPublish({ ...base, title: ' ' }).blockers).toContain('title_missing')
|
||||
})
|
||||
|
||||
it('sperrt einen leeren Beitrag', () => {
|
||||
expect(checkPublish({ ...base, blockCount: 0 }).blockers).toContain('content_empty')
|
||||
})
|
||||
|
||||
it('sperrt einen öffentlichen Beitrag mit Bild ohne Alt-Text', () => {
|
||||
const result = checkPublish({ ...base, audience: 'public', images: [{ hasAlt: false }] })
|
||||
expect(result.blockers).toContain('alt_text_missing')
|
||||
})
|
||||
|
||||
it('meldet fehlenden Alt-Text bei internen Beiträgen nur als Hinweis', () => {
|
||||
const result = checkPublish({ ...base, images: [{ hasAlt: false }] })
|
||||
expect(result.blockers).toEqual([])
|
||||
expect(result.hints).toContain('alt_text_missing')
|
||||
})
|
||||
|
||||
it('meldet fehlende Schlagworte und fehlendes Aufmacherbild als Hinweis', () => {
|
||||
const result = checkPublish({ ...base, tagCount: 0, hasCover: false })
|
||||
expect(result.blockers).toEqual([])
|
||||
expect(result.hints).toEqual(expect.arrayContaining(['tags_missing', 'cover_missing']))
|
||||
})
|
||||
|
||||
it('meldet fehlenden Alt-Text bei Kundenbeiträgen nur als Hinweis', () => {
|
||||
const result = checkPublish({ ...base, audience: 'customer', images: [{ hasAlt: false }] })
|
||||
|
||||
expect(result.blockers).toEqual([])
|
||||
expect(result.hints).toContain('alt_text_missing')
|
||||
})
|
||||
|
||||
it('sperrt einen öffentlichen Beitrag, wenn nur eines von mehreren Bildern keinen Alt-Text hat', () => {
|
||||
const result = checkPublish({
|
||||
...base,
|
||||
audience: 'public',
|
||||
images: [{ hasAlt: true }, { hasAlt: false }, { hasAlt: true }],
|
||||
})
|
||||
|
||||
expect(result.blockers).toContain('alt_text_missing')
|
||||
})
|
||||
|
||||
it('meldet mehrere Sperrgründe gleichzeitig', () => {
|
||||
const result = checkPublish({ ...base, title: '', blockCount: 0 })
|
||||
|
||||
expect(result.blockers).toEqual(expect.arrayContaining(['title_missing', 'content_empty']))
|
||||
})
|
||||
|
||||
it('sperrt einen Beitrag ohne Bilder nicht', () => {
|
||||
const result = checkPublish({ ...base, audience: 'public', images: [] })
|
||||
|
||||
expect(result.blockers).toEqual([])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user