import { describe, expect, it } from 'vitest'
import { ADDABLE_BLOCK_TYPES, defaultBlockData, type BlockType } from '../pages'

describe('defaultBlockData', () => {
  it('liefert sinnvolle Startwerte je Block-Typ', () => {
    expect(defaultBlockData('Heading')).toEqual({ text: '', level: 2 })
    expect(defaultBlockData('RichText')).toEqual({ markdown: '' })
    expect(defaultBlockData('Image')).toEqual({ url: '', alt: '' })
    expect(defaultBlockData('Gallery')).toEqual({ images: [] })
    expect(defaultBlockData('ContactInfo')).toEqual({ name: '', email: '', phone: '', address: '' })
    expect(defaultBlockData('AbgabetiereList')).toEqual({ mode: 'auto', intro: '' })
  })

  it('deckt jeden addbaren Typ ab', () => {
    for (const type of ADDABLE_BLOCK_TYPES) {
      expect(defaultBlockData(type)).toBeTypeOf('object')
    }
  })

  it('bietet die dynamische AbgabetiereList NICHT zum manuellen Anlegen an', () => {
    const addable: readonly BlockType[] = ADDABLE_BLOCK_TYPES
    expect(addable).not.toContain('AbgabetiereList')
  })
})
