I am trying to test a class which uses inversify for dependency injection and using @inject()
to decorate parameters.
@injectable()
export class SaveManager {
constructor(
@inject(INJECTABLE.STORAGE) storage: IStorage, //Uncovered Line: 15
@inject(Configuration) configuration: Configuration //Uncovered Line: 16
) {
this.storage = storage;
this.configuration = configuration;
}
}
But the branch coverage of this class shows me that:
@inject(INJECTABLE.STORAGE) storage: IStorage, //Uncovered Line: 15
@inject(Configuration) configuration: Configuration //Uncovered Line: 16
These lines are not covered.
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line
SaveManager.ts | 100 | 66.67 | 100 | 100 | 15,16
What should I test here to achieve 100% coverage and how can I test a constructor parameter decorator?
I know that I can use container.get()
but I should be able to test decorators too.