Hi all,
I implemented method and to test it I created command to call this method. My command works perfectly when it contains only this.messageService.info(‘some string’) but when I try to call my method, it results in this:
my code looks like this:
example class (simplified just to make sure the error is not inside)
import { injectable } from '@theia/core/shared/inversify';
@injectable()
export class CMakeListGenerator {
public generate(content: string): string {
let result: string;
result = 'AHOJ ';
result = result.concat(jsonFile);
console.log('RESULT: ' + content);
return result;
}
}
And command definition:
export const CMAKE_COMMAND: Command = {
id: 'CMAKE_COMMAND.command',
label: 'Generate CMAKE',
};
@injectable()
export class CMakeCommandContribution implements CommandContribution {
constructor(@inject(CMakeListGenerator) private readonly cmakeListGenerator: CMakeListGenerator) {}
registerCommands(commands: CommandRegistry): void {
commands.registerCommand(CMAKE_COMMAND, { execute: () => this.cmakeListGenerator.generate(PROJECT_HTC) });
}
}
I know I can test the method differently, I just wanted to use the command as it will be needed at the end in some way, so is there something I am generally missing?
Thank you