How would one unittest, with the default mocha framework for extensions, the action of selecting one of the items in an information/warning/error message that is part of a VSCode extension?
function foo() {
const GoToHelp = 'Go to Help';
vscode.window.showInformationMessage('Click for more Info', GoToHelp).then(selection => {
if (selection === GoToHelp) {
vscode.env.openExternal(vscode.Uri.parse('example.com'));
}
});
}
I know that you can test the individual items associate with an action, but doing so will not catch bugs arising from how the item selection integrates with the rest of the extension e.g. the action downloads an external tool, which is spawned as a process and needs to be await
ed for the process to complete successfully before the next window
action is performed.