Made db injectable
Added tests
Added test config