This PR refactors the download CSV function to be exported as an object: { download: function (params) {code...} }. This will facilitate in unit testing when we want to stub the functionality of the download function.
In my scenario, we are using Sinon for stubbing and mocking. The Sinon method - sinon.stub(object, "method") requires a root object and a property to stub on that object. Thus, we could not successfully stub the function since It is currently exported as a function not an object.
CONTEXT
This PR refactors the download CSV function to be exported as an object: { download: function (params) {code...} }. This will facilitate in unit testing when we want to stub the functionality of the download function.
In my scenario, we are using Sinon for stubbing and mocking. The Sinon method - sinon.stub(object, "method") requires a root object and a property to stub on that object. Thus, we could not successfully stub the function since It is currently exported as a function not an object.