title: Write tests sinon for a React Component with switch case
body: <pre><code>import React, { Component, PropTypes } from 'react';
  import classNames from 'classnames/bind';
  // import List from '../List/List';
  import TokenProvider from 'yoda-site-components/lib/helpers/TokenProvider/TokenProvider';
  import constant from '../../common/constant';
  import * as styles from './CardState.css';
  
  const cx = classNames.bind(styles);
  class CardState extends Component {
      static defaultProps = {
          cardDetails: {},
          imagePath: '',
      }
      static propTypes = {
          cardDetails: PropTypes.objectOf,
          imagePath: PropTypes.string,
          // deviceType: PropTypes.objectOf.isRequired,
      };
      constructor() {
          super();
          this.state = {
              cardTypeImage: this.getImageBasedOnRewardsTier(),
          };
      }
      getImageBasedOnRewardsTier = () =&gt; {
          const rewardTier = TokenProvider.get('DP_REWARDS_TIER') || 'RED';
  
          switch (rewardTier.toUpperCase()) {
              case 'SILVER':
                  return constant.camDashboard.cardState.rewardTierImages.SILVER;
  
              case 'GOLD':
                  return constant.camDashboard.cardState.rewardTierImages.GOLD;
  
              case 'PLATINUM':
                  return constant.camDashboard.cardState.rewardTierImages.PLATINUM;
  
              case 'BRONZE':
                  return constant.camDashboard.cardState.rewardTierImages.BRONZE;
  
              default: // red
                  return constant.camDashboard.cardState.rewardTierImages.BASE;
          }
      }
      render () {
          const cardDetails = this.props.cardDetails;
          const imagePath = `${this.props.imagePath}${this.state.cardTypeImage}`;
          return (
              &lt;div className={cx('creditCards')}&gt;
                  &lt;div className={cx('jcCreditCard')}&gt;
                      &lt;h2&gt;Credit Card&lt;/h2&gt;
                      &lt;div className={cx('creditCard')}&gt;
                          &lt;img src={imagePath} alt="" /&gt;
                      &lt;/div&gt;
                      &lt;div className={cx('creditCardDetails')}&gt;
                          &lt;h3 data-tlprivate="true" &gt;{cardDetails.address.lastName} {cardDetails.address.firstName}&lt;/h3&gt;
                          &lt;span&gt;JCPenney Cardmember&lt;/span&gt;
                          &lt;span data-tlprivate&gt;{cardDetails.cardNumber}&lt;/span&gt;
                          &lt;a className={cx('payBill')} href={constant.payMyBill}&gt;Pay My Bill&lt;/a&gt;
                          &lt;a className={cx('checkBalance')} href={constant.payMyBill}&gt;Check Balance &lt;/a&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          );
      }
  }
  
  export default CardState;
  </code></pre>
  
  <p>My Test file:</p>
  
  <pre><code>    import React from 'react';
  import { expect } from 'chai';
  import { shallow } from 'enzyme';
  import sinon from 'sinon';
  import TokenProvider from 'yoda-site-components/lib/helpers/TokenProvider/TokenProvider';
  import constant from '../../common/constant';
  import CardState from './CardState';
  
  const imagePath = 'm-dt-test1';
  const cardDetails = {
      address: {
      }
  };
  
  describe('&lt;CardState/&gt;', () =&gt; {
      const tokenGet = sinon.stub(TokenProvider, 'get');
  
      let wrapper;
  
      tokenGet.onCall(0).returns('SILVER');
      tokenGet.onCall(1).returns('GOLD');
      tokenGet.onCall(2).returns('PLATINUM');
      tokenGet.onCall(3).returns('RED');
  
  
      beforeEach(() =&gt; {
          wrapper = shallow(
              &lt;CardState imagePath={imagePath} cardDetails={cardDetails} /&gt;,
          );
      });
  
      it('on first call, this.state.cardTypeImage should be SILVER', () =&gt; {
          expect(wrapper.state().cardTypeImage).to.equal(constant.camDashboard.cardState.rewardTierImages.SILVER);
      });
  
      it('on next call, this.state.cardTypeImage should be GOLD', () =&gt; {
          expect(wrapper.state().cardTypeImage).to.equal(constant.camDashboard.cardState.rewardTierImages.GOLD);
      });
  
      it('on next call, this.state.cardTypeImage should be PLATINUM', () =&gt; {
          expect(wrapper.state().cardTypeImage).to.equal(constant.camDashboard.cardState.rewardTierImages.PLATINUM);
      });
  
      it('on next call, this.state.cardTypeImage should be BASE', () =&gt; {
          expect(wrapper.state().cardTypeImage).to.equal(constant.camDashboard.cardState.rewardTierImages.BASE);
      });
  });
  </code></pre>
  
  <p><strong>ERROR:</strong> Please help</p>
  
  <pre><code> 9 failing
  </code></pre>
  
  <p>1)  on first call, this.state.cardTypeImage should be SILVER:</p>
  
  <pre><code>  AssertionError: expected '/static-account/images/linkcreditcard/base.png' to equal '/static-account/images/linkcreditcard/platinum.png'
    + expected - actual
  
    -/static-account/images/linkcreditcard/base.png
    +/static-account/images/linkcreditcard/platinum.png
  
    at Context.&lt;anonymous&gt; (src/components/CardState/CardState.test.jsx:56:50)
  </code></pre>
  
  <p>2)  on next call, this.state.cardTypeImage should be GOLD:</p>
  
  <pre><code>  AssertionError: expected '/static-account/images/linkcreditcard/base.png' to equal '/static-account/images/linkcreditcard/gold.png'
    + expected - actual
  
    -/static-account/images/linkcreditcard/base.png
    +/static-account/images/linkcreditcard/gold.png
  
    at Context.&lt;anonymous&gt; (src/components/CardState/CardState.test.jsx:60:50)
  </code></pre>
  
  <p>3)  on next call, this.state.cardTypeImage should be PLATINUM:</p>
  
  <pre><code>  AssertionError: expected '/static-account/images/linkcreditcard/base.png' to equal '/static-account/images/linkcreditcard/platinum.png'
    + expected - actual
  
    -/static-account/images/linkcreditcard/base.png
    +/static-account/images/linkcreditcard/platinum.png
  </code></pre>
  
  <p>Please help</p>