Skip to content

Commit

Permalink
fix: add plugin version section(#755)
Browse files Browse the repository at this point in the history
fixes created issue so it passes GH bot validation

updates test names based on feedback

* chore: fix salesforcedx/linked plugins test name/output

* fix: add plugin version keyword to satisfy issue validator

* test: update UT assertions
  • Loading branch information
WillieRuemmele authored May 31, 2024
1 parent 64fa7a0 commit 9a7432c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/commands/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ export default class Doctor extends SfCommand<SfDoctorDiagnosis> {
private generateIssueMarkdown(body: string, diagnosis: SfDoctorDiagnosis): string {
const info = `
\`\`\`
CLI:
${diagnosis.cliConfig.userAgent}
Plugin Version:
${diagnosis.versionDetail.pluginVersions.join(EOL)}
\`\`\`
${
Expand Down
12 changes: 8 additions & 4 deletions src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export class Diagnostics {
* to uninstall it if there.
*/
public async salesforceDxPluginCheck(): Promise<void> {
const testName = 'salesforcedx plugin not installed';
let status: DiagnosticStatus['status'] = 'pass';

const plugins = Object.keys(this.config.versionDetails.pluginVersions ?? {});
Expand All @@ -119,7 +118,10 @@ export class Diagnostics {
const bin = this.diagnosis.cliConfig.bin;
this.doctor.addSuggestion(messages.getMessage('salesforceDxPluginDetected', [bin]));
}
await Lifecycle.getInstance().emit('Doctor:diagnostic', { testName, status });
await Lifecycle.getInstance().emit('Doctor:diagnostic', {
testName: status === 'pass' ? 'salesforcedx plugin isn’t installed' : 'salesforcedx plugin is installed',
status,
});
}

public async networkCheck(): Promise<void> {
Expand Down Expand Up @@ -165,7 +167,6 @@ export class Diagnostics {
* Checks and warns if any plugins are linked.
*/
public async linkedPluginCheck(): Promise<void> {
const testName = 'no linked plugins';
let status: DiagnosticStatus['status'] = 'pass';

const plugins = this.config.getPluginsList();
Expand All @@ -174,6 +175,9 @@ export class Diagnostics {
status = 'fail';
this.doctor.addSuggestion(messages.getMessage('linkedPluginWarning', [lp.name]));
});
await Lifecycle.getInstance().emit('Doctor:diagnostic', { testName, status });
await Lifecycle.getInstance().emit('Doctor:diagnostic', {
testName: status === 'pass' ? "you don't have any linked plugins" : 'you have at least one linked plugin',
status,
});
}
}
8 changes: 4 additions & 4 deletions test/diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ describe('Diagnostics', () => {
expect(drAddSuggestionSpy.called).to.be.false;
expect(lifecycleEmitSpy.called).to.be.true;
expect(lifecycleEmitSpy.args[0][1]).to.deep.equal({
testName: 'salesforcedx plugin not installed',
testName: 'salesforcedx plugin isn’t installed',
status: 'pass',
});
});
Expand All @@ -257,7 +257,7 @@ describe('Diagnostics', () => {
expect(drAddSuggestionSpy.called).to.be.true;
expect(lifecycleEmitSpy.called).to.be.true;
expect(lifecycleEmitSpy.args[0][1]).to.deep.equal({
testName: 'salesforcedx plugin not installed',
testName: 'salesforcedx plugin is installed',
status: 'fail',
});
});
Expand Down Expand Up @@ -312,7 +312,7 @@ describe('Diagnostics', () => {
expect(drAddSuggestionSpy.called).to.be.false;
expect(lifecycleEmitSpy.called).to.be.true;
expect(lifecycleEmitSpy.args[0][1]).to.deep.equal({
testName: 'no linked plugins',
testName: "you don't have any linked plugins",
status: 'pass',
});
});
Expand Down Expand Up @@ -344,7 +344,7 @@ describe('Diagnostics', () => {
expect(drAddSuggestionSpy.called).to.be.true;
expect(lifecycleEmitSpy.called).to.be.true;
expect(lifecycleEmitSpy.args[0][1]).to.deep.equal({
testName: 'no linked plugins',
testName: 'you have at least one linked plugin',
status: 'fail',
});
});
Expand Down

0 comments on commit 9a7432c

Please sign in to comment.