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

Always treat encoding as a string for encoding.trim() #2392

Merged
merged 8 commits into from
Dec 24, 2024

Conversation

COBOL-Erik
Copy link
Contributor

@COBOL-Erik COBOL-Erik commented Dec 17, 2024

encoding.trim() only works if encoding is interpreted as a string, but it might just be a number.

What It Does

How to Test

Review Checklist
I certify that I have:

Additional Comments

encoding.trim() only works if encoding is interpreted as a string, but it might just be a number.

Signed-off-by: COBOL-Erik <[email protected]>
Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

Hey @COBOL-Erik,
The fix LGTM! 😋

Curious if you could:

  • Add a Changelog entry to the packages/zosjobs/src/CHANGELOG.md file?
  • (maybe) add a quick test for the encoding being a number? 🙏

packages/zosjobs/src/GetJobs.ts Outdated Show resolved Hide resolved
zFernand0 and others added 2 commits December 17, 2024 16:18
More succinct

Co-authored-by: Fernando Rijo Cedeno <[email protected]>
Signed-off-by: COBOL-Erik <[email protected]>
@COBOL-Erik
Copy link
Contributor Author

Hey @COBOL-Erik, The fix LGTM! 😋

Curious if you could:

  • Add a Changelog entry to the packages/zosjobs/src/CHANGELOG.md file?
  • (maybe) add a quick test for the encoding being a number? 🙏

Hi!
I added a change log entry. Not sure how I would add a test, though. Could you help me out?

Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

Left a few comments to address.

Note: even though typescript should prevent people from calling the getSpoolContentById with a number e.g. 939 as the encoding value, nothing prevents people from bypassing it 😋

And for the test, you could add a new one in:

  • packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts

And you could copy the following test to create a new one:

  • it("should return spool content from getSpoolContentById with encoding if z/OSMF response is mocked" ...

And the resulting test might look something like this:

        it("should return spool content from getSpoolContentById with encoding as a number if z/OSMF response is mocked", async () => {
            (ZosmfRestClient.getExpectString as any) = mockGetJobsStringData(GetJobsData.SAMPLE_JES_MSG_LG);
            const content = await GetJobs.getSpoolContentById(pretendSession, "MYJOB1", "JOB0123", 1, 939 as any);
            expect((ZosmfRestClient.getExpectString as any).mock.calls[0][1]).toContain("fileEncoding=939");
            expect(content).toEqual(GetJobsData.SAMPLE_JES_MSG_LG);
        });

packages/zosjobs/CHANGELOG.md Outdated Show resolved Hide resolved
packages/zosjobs/src/GetJobs.ts Outdated Show resolved Hide resolved
@COBOL-Erik
Copy link
Contributor Author

I have tried to do everything by the book now. I'm sure I have missed something... Where are we?

COBOL-Erik and others added 5 commits December 23, 2024 15:38
Co-authored-by: Timothy Johnson <[email protected]>
Signed-off-by: COBOL-Erik <[email protected]>
"Recent Changes"

Co-authored-by: Fernando Rijo Cedeno <[email protected]>
Signed-off-by: COBOL-Erik <[email protected]>
Co-authored-by: Fernando Rijo Cedeno <[email protected]>
Signed-off-by: COBOL-Erik <[email protected]>
Co-authored-by: Timothy Johnson <[email protected]>
Signed-off-by: COBOL-Erik <[email protected]>
@t1m0thyj
Copy link
Member

I have tried to do everything by the book now. I'm sure I have missed something... Where are we?

There were 2 commits that were not properly signed off:

Commit sha: 2d7b68d, Author: S38453, Committer: S38453; The sign-off is missing.
Commit sha: 5ae8fbc, Author: S38453, Committer: S38453; Expected "S38453 [email protected]", but got "COBOL-Erik [email protected]".

I've rebased the PR to amend these commits so the DCO check should be passing now. As the Audit check is failing on master branch, you don't need to worry about it. 🙂

In the future, please ensure when making Git commits that your Git author is set to COBOL-Erik (not S38453), and either pass the --signoff flag on the git commit command or include the "Signed-off-by" line in your commit message.

Copy link
Member

@t1m0thyj t1m0thyj left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @COBOL-Erik!

Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @COBOL-Erik!

@t1m0thyj t1m0thyj dismissed zFernand0’s stale review December 24, 2024 14:34

Changes were addressed

@traeok traeok merged commit 0d3f6a9 into zowe:master Dec 24, 2024
26 of 27 checks passed
@traeok traeok added the release-patch Indicates a patch to existing code has been applied label Dec 24, 2024
Copy link

Release succeeded for the master branch. 🎉

The following packages have been published:

Powered by Octorelease 🚀

@COBOL-Erik COBOL-Erik deleted the patch-1 branch December 27, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-patch Indicates a patch to existing code has been applied released
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

4 participants