-
Notifications
You must be signed in to change notification settings - Fork 14
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
Wr/data bugs #266
Wr/data bugs #266
Conversation
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 like having these new exemplars for the edge cases that keep popping up.
@@ -182,7 +182,11 @@ export abstract class DataCommand extends SfdxCommand { | |||
throw new Error(messages.getMessage('TextUtilMalformedKeyValuePair', [pair])); | |||
} else { | |||
const key = pair.substr(0, eqPosition); | |||
constructedObject[key] = this.convertToBooleanIfApplicable(pair.substr(eqPosition + 1)); | |||
if (pair.includes('{') && pair.includes('}')) { |
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 could see this being true but not being parseable JSON (ex: a big textArea that's referring to some code like a Case).
So it's probably a fine solution but we'll need a try/catch on the JSON.parse because it might not be, and then we'd want to return the original value?
@@ -247,4 +247,20 @@ describe('data:record commands', () => { | |||
expect(result).to.have.property('Bool__c', false); | |||
}); | |||
}); | |||
|
|||
it('will parse JSON correctly for update', () => { |
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 have a test to match the above comment--something that isn't valid json but contains curly brackets.
} | ||
|
||
protected stringToDictionary(str: string): Dictionary<string | boolean> { | ||
protected stringToDictionary(str: string): Dictionary<string | boolean | Record<string, unknown>> { |
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.
For the sake of readability you might consider making a new type for this.
QA notes
|
QA notes:
|
What does this PR do?
fixes various bugs with
data
lots of the QA steps will be found in the associated WI
What issues does this PR fix or reference?
@W-10290520@ forcedotcom/cli#1318
@W-10290524@ forcedotcom/cli#72
@W-5380834@