pjasiun / fuma

Fussball Manager for Slack
MIT License
4 stars 4 forks source link

Important refactoring for tests sake. #30

Closed jodator closed 8 years ago

jodator commented 8 years ago

I think that at least one file could be improved for tests: history.js. But probably other files are dependend on this one.

The idea is to make all files as classes and eventualy pass them to commands by context or other means.

This is problematic:

const historyData = require( '../storage' )( 'history', { data: [] } );

module.exports = new History( historyData );

and similar constructs to this. I think that all modules should just expose classes and all the wiring would be done in controller.

Making this so allow for easier mocks in tests.

jodator commented 8 years ago

Btw I can do this ;)

pjasiun commented 8 years ago

:+1:

I totally agree with both that const historyData = require( '../storage' )( 'history', { data: [] } ); is problematic and that context might be a solution. Feel free to refactor.