All academies
All challenges

Refactor tight coupling

DI

solution.ts
medium+80 XP

Refactor so `ReportService` depends on `interface Database { query(sql: string): string[] }` injected in the constructor. Provide `MemoryDatabase` returning `['ok']` for any query. `run()` returns db.query('select 1').

Judge

Press Run tests to execute your solution in the sandbox judge.