title: How to test js factory function using mocha & chai
body: <p>I am trying to test my DOM project, so it should make sure that the cost is 2.75 and sms is 0.75. It returns an assertion error that says expected 2.75 to equal undefined. I need help 
  accessing the correct values of call and sms.
  Here's my factory function</p>
  
  <pre><code>    var callCost = 0;
      var smsCost = 0;
      var totalCost = 0;
  
      const warning = 30;
      const critical = 50;
  
      function getCall() {
          return callCost;
      }
  
      function getSms() {
          return smsCost;
      }
  
      function getTotal() {
          totalCost = callCost + smsCost;
          return totalCost;
      }
  
      function radioButtons(selectedBill) {
          if (selectedBill === "call") {
              callCost += 2.75;
          } else if (selectedBill === "sms") {
              smsCost += 0.75;
          }
      }
  
      function totalClassName() {
          if (getTotal() &gt;= warning &amp;&amp; getTotal() &lt; critical) {
              return "warning";
          } else if (getTotal() &gt;= critical) {
              return "critical";
          }
      }
  
      return {
          getCall,
          getSms,
          getTotal,
          radioButtons,
          totalClassName
      }
  }
  
  
  describe('The radio-bill function', function(){
      it('Should be able to add call at 2.75', function(){
          var itemType = RadioBill();
          itemType.radioButtons("call");
          assert.equal(2.75, itemType.radioButtons("call"))
      })
  })
  
  </code></pre>