import { expect } from 'chai'
import InteractionType from 'quiz-interactions/lib/records/InteractionType'

import { interactionTypeMetadata } from '../interactionTypeMetadata'

describe('interactionTypeMetadata', () => {
  const fakeInteractionType = (slug = 'choice', params = {}) => new InteractionType({slug, ...params})

  it('returns icon and translated name for known types', () => {
    const type = fakeInteractionType()
    const metadata = interactionTypeMetadata(type)
    expect(metadata.name).to.be.equal('Multiple Choice')
    expect(metadata.icon).to.not.be.undefined()
  })

  it('returns icon and translated name for known types', () => {
    const type = fakeInteractionType('unknown', {name: 'Unknown name'})
    const metadata = interactionTypeMetadata(type)
    expect(metadata.name).to.be.equal('Unknown name')
    expect(metadata.icon).to.not.be.undefined()
  })
})
