-
Notifications
You must be signed in to change notification settings - Fork 1
W-19995335: update validate agent #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| const targetOrg = flags['target-org']; | ||
| const conn = targetOrg.getConnection(flags['api-version']); | ||
| // Call Agent.compileAgent() API | ||
| await sleep(Duration.seconds(2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove this and the sleep
| }); | ||
| }); | ||
|
|
||
| describe('flag validation', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these tests should be removed, the --api-version flag validation is already tested in sf-plugins-core
| import { throwAgentCompilationError } from '../../../../src/common.js'; | ||
|
|
||
| describe('Agent Validate Authoring Bundle', () => { | ||
| describe('command configuration', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to test that the command has a specific summary, or required project, etc...
| } | ||
| } catch (error) { | ||
| // Handle validation errors | ||
| const err = SfError.wrap(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be using the throwAgentCompilationError method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This catch block is used to handle all error, not only compilation errors returned from the api
QA Notes✅ : no error ➜ sf agent validate authoring-bundle
? API name of the authoring bundle to validate my_AGent
────── Validating my_AGent Authoring Bundle ──────
✔ Validating Authoring Bundle 1.36s
▸ Status: COMPLETED
▸ Errors: 0
Elapsed Time: 1.38s✅ : error ➜ sf agent validate authoring-bundle
? API name of the authoring bundle to validate my_AGent
────── Validating my_AGent Authoring Bundle ──────
✘ Validating Authoring Bundle 1.33s
▸ Status: ERROR
▸ Errors: 1
Elapsed Time: 1.34s
Compilation of the agent file failed with the following errors:
- SyntaxError: Unexpected 'sysem' [Ln 1, Col 0] |
What does this PR do?
Update error handling for compilation errors.
What issues does this PR fix or reference?
@W-19995335@