In my nodejs project, I have functions like this for socketio.socket.on('draw', function (data) {    socket.broadcast.to(socket.room).emit('draw', data);    addEvent(socket, [draw, data]);});I'd like to rewrite them to something like this:function onDraw(socket, config) {    return function (data) {        socket.broadcast.to(socket.room).emit('draw', data);        addEvent(socket, [draw, data]);    }}socket.on('draw', onDraw(socket, config));The idea is that by placing all of my functions in simple closures like this, I can put them in different modules and it will make it easier to test by passing mockup objects to the function that construct the callback.I was wondering if it was overkill or if there is a better way to make my code testable?
Wrapping function in closures to make testable functions
tdd;node.js