Closed jodator closed 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.
history.js
The idea is to make all files as classes and eventualy pass them to commands by context or other means.
context
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.
Btw I can do this ;)
:+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.
const historyData = require( '../storage' )( 'history', { data: [] } );
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:
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.