-
-
Notifications
You must be signed in to change notification settings - Fork 230
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: add base64 encode transformation #1257
base: main
Are you sure you want to change the base?
Conversation
2453eec
to
c248752
Compare
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.
Can you please add tests?
Take a look at the original tests and try to replicate those :)
Could you clarify please what should be done? Do you mean add test cases to this json? |
Ah, good catch! They are already there! Don't need to add them 😄 |
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.
LGTM! Thanks for your contribution!
I wonder why tests didn't run :/ |
Ok, I forced a small update to the date to force running local tests :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1257 +/- ##
=======================================
Coverage 81.68% 81.69%
=======================================
Files 168 169 +1
Lines 9762 9767 +5
=======================================
+ Hits 7974 7979 +5
Misses 1537 1537
Partials 251 251
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This PR brings base64Encode method.
Issue 1252
This changes rely on
encoding/base
std librarybase64.StdEncoding.EncodeToString
I spent a little bit of time to investigate if it's necessary to implement custom base64Encode. If you have any doubts, real cases where std doesn't work or not appropriate for this project, please let me know here.
Make sure that you've checked the boxes below before you submit PR:
As long as this implementation is technically a one liner that relies on std lib there is no real reason make unit test for it, otherwise we'll test std lib.
Plus as I can see there is a ready test data for
base64encode
intransformation/testdata/base64encode.json
which is used inTestTransformations
.Plus I see there is no
test.go
files for the other one liners (ex.hexEncode
), as I understood just to avoid bloating the codebase.This code follows the code style in the project: has a specific signature with 3 returning parameters
(string, bool, error)
as I understand for the future flexibility and compatibility.I ran
CGO_ENABLED=1 go run mage.go check
on my local machine and didn't get any fail.Thanks for your contribution ❤️