Skip to content

Conversation

@rmohan20
Copy link
Contributor

No description provided.

@rmohan20 rmohan20 marked this pull request as draft July 26, 2022 17:42
@rmohan20 rmohan20 changed the title @W-11486406@ Fix survey request formatting issue @W-11494080@ Fix survey request formatting issue Jul 26, 2022
/**
* Common steps that should be run before every command
*/
protected runCommonSteps(): void {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A place to put common steps so that we don't have to modify each command every time we change things.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being its own method feels excessive. You could just do these things in run() before invoking runInternal()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runCommonSteps() behaves as a hook that would continue to keep run() more readable as the common steps expand.
Also, we may have a subgroup of commands that require to do a variation of the common steps and override it to their convenience. For example, in an abstract class like ScannerRunCommand.
In near future, if we decide to remove the survey link, I'd still recommend leaving the hook with a marker comment on what can possibly be added there.

@rmohan20 rmohan20 marked this pull request as ready for review July 26, 2022 18:25
@rmohan20 rmohan20 force-pushed the rm/jsonFormatIssue-3.x branch from 3d19af0 to 51284f4 Compare July 26, 2022 18:28
/**
* Common steps that should be run before every command
*/
protected runCommonSteps(): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being its own method feels excessive. You could just do these things in run() before invoking runInternal()

expect(ctxJson.result.length).to.equal(0, 'Should be no results');
expect(ctxJson.warnings.length).to.equal(1, 'Should be one warning');
expect(ctxJson.warnings[0]).to.equal(formattedWarning, 'Warning message should match');
expect(ctxJson.warnings.length).to.equal(2, 'Should be one warning');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure text says "one" instead of "two".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix this

@rmohan20 rmohan20 merged commit 875aff1 into dev-3 Jul 26, 2022
@rmohan20 rmohan20 linked an issue Jul 27, 2022 that may be closed by this pull request
@stephen-carter-at-sf stephen-carter-at-sf deleted the rm/jsonFormatIssue-3.x branch May 17, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] stdout not in proper JSON format when --format json is used

3 participants