Conversation
Bunchhieng
left a comment
There was a problem hiding this comment.
Looks good. Feel free to modify the checkOS method to support Windows or Linux in this PR or I can add a follow-up issue to address it. Thanks
| - [Fatih Arslan](https://github.com/fatih/color) | ||
| - [Martin Angers](https://github.com/PuerkitoBio/goquery) | ||
| - [skratchdot](https://github.com/skratchdot/open-golang) | ||
| - [Corey Prak](https://www.instagram.com/prakattak/) |
There was a problem hiding this comment.
This section is mainly for the dependencies I use on the project. Your name will show up in the release. 👍
There was a problem hiding this comment.
Ah, definitely. I'll add a credit to stretchr maybe?
| "brave": "Brave", | ||
| } | ||
|
|
||
| if os == "darwin" { |
There was a problem hiding this comment.
I was thinking if we can refactor this to support Windows and Linux.
There was a problem hiding this comment.
That sounds good - would the denormalized values be anything different?
There was a problem hiding this comment.
I add this issue. there is a list of all the OS name. the browser string may be vary between each OS.
#21
|
Would you be able to fix the merge conflict? @Xercoy |
|
@Bunchhieng I'll work on it and ping you when it's done. Apologies for the delay. |
|
closing in favor of #50 |
getBrowserNameByOSdoesn't have unit tests, so I decided to add one.Right now, it's basically a subtest that runs based on the value of
runtime.GOOSsince the waygetBrowserNameByOSis written is only meant to handle cases where we're dealing with adarwinbased OS. Not only does the unit test do that, but it tests every possible denormalized string value.I was thinking that since the function only handles cases for a
darwinOS, we can ensure that any other value forruntime.GOOSwill result in a return value of a null string. While it does adhere to the current behavior, I feel like it could be overkill.The code for it also seemed like it could have been simplified a bit for a few reasons:
switch, caseblocks for basic logic just seemed like it could be simplified.To ensure that my changes to the function work as intended, I created the test, ran the entire test suite and ensured it passed, modified
getBrowserNameByOS, then ran tests a final time to ensure its behavior remained unchanged.