import { test } from '@japa/runner'
import { normalizeXmlTagName } from '../../../../src/amf/shape/ShapeXmlSchemaGenerator.js'

test.group('normalizeXmlTagName()', () => {
  test('removes prohibited characters', ({ assert }) => {
    const name = 'a & b = c?'
    const result = normalizeXmlTagName(name)
    assert.equal(result, 'abc')
  })

  test('keeps hyphen characters', ({ assert }) => {
    const name = 'a-&-b =-c?'
    const result = normalizeXmlTagName(name)
    assert.equal(result, 'a--b-c')
  })

  test('keeps underscore characters', ({ assert }) => {
    const name = 'a_&_b =_c?'
    const result = normalizeXmlTagName(name)
    assert.equal(result, 'a__b_c')
  })

  test('keeps dot characters', ({ assert }) => {
    const name = 'a.&.b =.c?'
    const result = normalizeXmlTagName(name)
    assert.equal(result, 'a..b.c')
  })
})
