Skip to content
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

feat: guarantee fileResponseSuccess has a path #1358

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Jun 27, 2024

really a type refactor; no intended functionality change for SDR

SDR is the source of FileResponse (and its subtype FileResponseSuccess).

All the real code that produces them provide a filepath, but the type has it as ?.

consumers with strict TS have to do checks for no reason.

fixes part of https://github.com/forcedotcom/eslint-config-salesforce-typescript/actions/runs/9703130477/job/26780562510?pr=246#step:9:9

so I guess it's related to @W-16116290@

@mshanemc mshanemc requested a review from a team as a code owner June 27, 2024 22:47
@@ -548,13 +548,13 @@ describe('MetadataApiDeploy', () => {
fullName,
type: type.name,
state: ComponentStatus.Changed,
filePath: content,
filePath: ensureString(content),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's a bunch of these in the test. The mocks come from SourceComponent, which has xml and content as optional properties.

the tests assert that they're there.

It's harder to work with the SourceComponent class (ex: to make SourceComponentWithXmlAndContent, etc) the way you would a simple object/type or to put a type guard around it
...
so it's probably simpler to do this ensure stuff for UT.

@mshanemc mshanemc merged commit 9a1d565 into main Jun 28, 2024
75 checks passed
@mshanemc mshanemc deleted the sm/fileResponseSuccess-has-filepath branch June 28, 2024 15: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.

3 participants