initiatived21/d21

View on GitHub
client/app/Sidebar/components/PledgeSidebar_test.js

Summary

Maintainability
A
1 hr
Test Coverage
import React       from 'react'
import { shallow } from 'enzyme'

import PledgeSidebar from './PledgeSidebar'
import SignPledgeFormContainer from '../containers/SignPledgeFormContainer'
import ReportPledgeForm from './ReportPledgeForm'

describe('<PledgeSidebar />', function () {
  const props = {
    pledge_id: 1,

    forms: {
      signPledgeForm: {
        action: '/',
        authToken: 'a',
        model: 'signature'
      },
      updateForm: {
        action: '/',
        authToken: 'a',
        model: 'update'
      }
    },
    isPreview: false,
    isDraft: false,
    showSignForm: true,
    activateAction: '/',
    userIsInitiator: false,
    userConfirmed: false,
    renderReportForm: true
  }

  it('should render', function () {
    const wrapper = shallow(<PledgeSidebar {...props} />)

    wrapper.find(SignPledgeFormContainer).length.should.equal(1)
    wrapper.find(ReportPledgeForm).length.should.equal(1)
  })

  it('should "pass through" its className prop', function() {
    const wrapper = shallow(<PledgeSidebar {...props} className="dummy" />)

    wrapper.hasClass('dummy').should.be.true
  })
})