Skip to content
Loading
I have query regarding refactoring code  
  •   
  • "text/javascript">  
  • document.addEventListener("DOMContentLoaded"function () {  
  • var p = new ProductDataRenderer();  
  • p.render();  
  • });  
  •   
  •   
  •   
  •   
  •   
  • "utf-8">  
  • RefactorMe Tests  
  • "stylesheet" href="http://code.jquery.com/qunit/qunit-1.17.1.css">  
  •   
  •   
  • "qunit">  
  • "qunit-fixture">  
  • "http://code.jquery.com/qunit/qunit-1.17.1.js">  
  • "src/tests.js">  
  •   
  •   
  • function TShirtRepository() {  
  • }  
  •   
  • TShirtRepository.prototype.getAll = function () {  
  • return [  
  • {  
  • id: 1,  
  • colour: "Blue",  
  • name: "Xamarin C# T-Shirt",  
  • price: 15.0,  
  • shirtText: "C#, Xamarin"  
  • }, {  
  • id: 2,  
  • colour: "Black",  
  • name: "New York Yankees T-Shirt",  
  • price: 8.0,  
  • shirtText: "NY"  
  • }, {  
  • id: 3,  
  • colour: "Green",  
  • name: "Disney Sleeping Beauty T-Shirt",  
  • price: 10.0,  
  • shirtText: "Mirror mirror on the wall..."  
  • }  
  • ];  
  • }  
  • function PhoneCaseRepository() {  
  • }  
  •   
  • PhoneCaseRepository.prototype.getAll = function () {  
  • return [  
  • {  
  • id: 1,  
  • name: "Amazon Fire Burgundy Phone Case",  
  • colour: "Burgundy",  
  • material: "PVC",  
  • targetPhone: "Amazon Fire",  
  • price: 14.0  
  • }, {  
  • id: 2,  
  • name: "Nokia Lumia 920/930/Icon Crimson Phone Case",  
  • colour: "Red",  
  • material: "Rubber",  
  • targetPhone: "Nokia Lumia 920/930/Icon",  
  • price: 10.0  
  • }  
  • ]  
  • }
  • 1 Reply

    Know the answer? Post it — somebody with the same question will find it here.