title: Structuring Mocha test with objects
body: <p>Trying to learn some js and mocha and am sure im doing something fundamentally wrong.  For example:</p>
  
  <p>Product model:</p>
  
  <pre><code>var Product = function (sku) {
      this.sku = sku;
  };
  
  Product.prototype.getSku = function() {
      return this.sku;
  }
  
  module.exports = {Product: Product};
  </code></pre>
  
  <p>and my tests:</p>
  
  <pre><code>var productLib = require('../../model/Product.js');
  var assert = require('assert')
  
  describe("Product", function() {
      describe('#getSku()', function() {
  
          var product = new productLib.Product('test_sku');
          it('should have an getSku method', function() {
              assert.equal(typeof product.getSku, 'function');
          });
          it('should return the loaded sku', function() {
              assert.equal(product.getSku(), 'test_sku');
          });
      });
  });
  </code></pre>
  
  <p>Is this correct in terms of how the product model is structured and exported?  It seems wrong but i had to do it this way so that in the test I could do:</p>
  
  <pre><code>var product = new productLib.Product('test_sku');
  </code></pre>
  
  <p>and have the assertion that the sku was set correctly.</p>