import React from 'react'

import MetricsListItem from '../'

describe('MetricsListItem', () => {
  const testbed = createTestbed(MetricsListItem, {
    label: 'Label',
    value: '999.9'
  })

  shouldRenderComponent(testbed, {}, MetricsListItem)

  it('should render label text', () => {
    testbed.render()
    expect(testbed.getText()).to.include('Label')
  })

  it('should render value text', () => {
    testbed.render()
    expect(testbed.getText()).to.include('999.9')
  })

  it('should accept components as value', () => {
    testbed.render({ value: <span>1/2</span> })
    expect(testbed.getText()).to.include('1/2')
  })

  it('should render no value', () => {
    testbed.render({ value: null })
    expect(testbed.getText()).to.include('No value')
    expect(testbed.getText()).to.include('--')
  })
})
