import IfFeature from '../index'
import Presenter from '../presenter'

import { withTestFeatures } from '../../../../util/featureCheck'

describe('IfFeature', () => {
  const testbed = createTestbed(withContext(IfFeature), {
    name: 'hot_new_feature'
  })

  it('should fetch feature status from store', () => {
    testbed.render()
    expect(testbed.findChildByType(Presenter).props.isOn).to.be.false()
  })

  context('with features enabled', () => {
    withTestFeatures(['hot_new_feature'])

    it('should fetch feature status from store', () => {
      testbed.render()
      expect(testbed.findChildByType(Presenter).props.isOn).to.be.true()
    })
  })
})
